Skip to content

[autest] thread_config: add startup polling and skip test on non-Linux#12940

Merged
bryancall merged 2 commits intoapache:masterfrom
moonchen:fix-check-threads-race
Mar 17, 2026
Merged

[autest] thread_config: add startup polling and skip test on non-Linux#12940
bryancall merged 2 commits intoapache:masterfrom
moonchen:fix-check-threads-race

Conversation

@moonchen
Copy link
Contributor

@moonchen moonchen commented Mar 4, 2026

check_threads.py now uses a short bounded poll/retry window so thread-count validation doesn’t fail on startup races.

The test is also skipped on non-Linux because per-thread introspection used by this check is not available there.

check_threads.py now uses a short bounded poll/retry window so thread-count validation doesn’t fail on startup races; the test is also skipped on macOS because per-thread introspection used by this check is not reliably available there.
@moonchen moonchen requested review from bneradt and Copilot March 4, 2026 20:20
@moonchen moonchen self-assigned this Mar 4, 2026
@moonchen moonchen added the AuTest label Mar 4, 2026
@moonchen moonchen added this to 11-Dev Mar 4, 2026
@moonchen moonchen added this to the 11.0.0 milestone Mar 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the thread_config gold test to be more reliable during ATS startup by adding a bounded poll/retry window for thread-count validation, and it restricts the test to platforms where per-thread introspection is supported.

Changes:

  • Add a bounded poll/retry loop in check_threads.py to avoid thread-count validation failing due to startup races.
  • Skip the thread_config gold test on non-Linux platforms via SkipUnless(IsPlatform("linux")).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/gold_tests/thread_config/thread_config.test.py Skips the thread configuration test unless running on Linux.
tests/gold_tests/thread_config/check_threads.py Adds retry-based thread counting and expands ATS process matching logic for more robust detection.

Copy link
Contributor

@brbzull0 brbzull0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we are addressing the same issue #12916
I'm kinda inclined to yours as it catches a few things mine doesn't.

@bryancall bryancall self-requested a review March 9, 2026 22:22
@bryancall bryancall removed this from 11-Dev Mar 9, 2026
Copy link
Contributor

@bryancall bryancall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Co-pilot made some recommendations. I think the main one is the exit code. Besides that, looks good.

Copy link
Contributor

@bryancall bryancall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry logic looks good overall, but there's an exit code ambiguity that should be fixed:

_count_threads_once() returns code 1 when p.threads() fails ("Could not inspect ATS process threads"), but count_threads() treats code 1 as a retryable "process not found yet" condition in retry_codes = {1, 4, 6, 9, 11}. This means a real permission/psutil error gets silently retried for the full 10s window instead of failing immediately.

Please use a distinct exit code (e.g. 12) for the p.threads() failure case so it's not masked by the retry loop.

@moonchen
Copy link
Contributor Author

The retry logic looks good overall, but there's an exit code ambiguity that should be fixed:

_count_threads_once() returns code 1 when p.threads() fails ("Could not inspect ATS process threads"), but count_threads() treats code 1 as a retryable "process not found yet" condition in retry_codes = {1, 4, 6, 9, 11}. This means a real permission/psutil error gets silently retried for the full 10s window instead of failing immediately.

Please use a distinct exit code (e.g. 12) for the p.threads() failure case so it's not masked by the retry loop.

I've added a distinct exit code 12 for the condition when psutil gets an access denied, so the test fails immediately.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@bryancall bryancall changed the title [autest] thread_config: fix race and skip on macOS [autest] thread_config: add startup polling and skip test on non-Linux Mar 17, 2026
@bryancall bryancall merged commit 6dfaadd into apache:master Mar 17, 2026
19 checks passed
@github-project-automation github-project-automation bot moved this to For v10.2.0 in ATS v10.2.x Mar 17, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Mar 18, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Mar 18, 2026
@cmcfarlen
Copy link
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Mar 18, 2026
#12940)

* thread_config: add startup polling for thread checks and skip on non-Linux
check_threads.py now uses a short bounded poll/retry window so thread-count
validation does not fail on startup races; the test is also skipped on
non-Linux platforms because per-thread introspection used by this check is not
reliably available there.
* thread_config: stop retrying when Process.threads() access is denied

(cherry picked from commit 6dfaadd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

5 participants