fix(pyamber, test, v1.2): stabilize flaky AtomicInteger get_and_set deadlock test - #7402
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
…k test (#7295) ### What changes were proposed in this PR? `test_get_and_set_does_not_deadlock_on_non_reentrant_lock` (added in #5010) waited on an `Event` for a fixed 0.5s and then asserted `not worker.is_alive()`. The worker sets that event *inside* `attempt()`, before the thread exits, so the assertion could fire while a perfectly correct `get_and_set` was still tearing down — and if the worker didn't finish inside the 0.5s budget at all, the assert failed outright. Both are wall-clock races unrelated to the deadlock the test guards, and both surface under CI load. Replaced the fixed window with `worker.join(timeout=5)`. `join` returns only once the thread is really dead, which is the precondition `is_alive()` needs, and it returns in microseconds on a correct implementation — so the timeout costs nothing in practice while still letting a real deadlock keep the worker alive past it and trip the same assertion. The regression-detection intent is unchanged. Test-only change; no production code touched. ### Any related issues, documentation, discussions? Closes #7294. ### How was this PR tested? `pytest amber/src/test/python/core/util/test_atomic.py` locally on Python 3.12 — 11 passed, run repeatedly, all green in ~0.6s per run (the join adds no measurable time). Failure path verified: temporarily reintroducing the #4794 deadlock in `AtomicInteger.get_and_set` (`old_value = self.value` while holding the non-reentrant lock) makes the test fail red with the same `assert not True` and pytest exit code 1 after the 5s join timeout. `ruff check` and `ruff format --check` clean on the touched file. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-fable-5) (backported from commit d2fe4ba) Co-authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
Contributor
Author
|
The cherry-pick applied cleanly but the backported tree failed its pre-merge build. Fix the build on this branch, then mark this PR ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Automated backport of #7295 to
release/v1.2.Source: d2fe4ba · automation run
Any related issues, documentation, discussions?
Backport of #7295. Originally linked #7294.
How was this PR tested?
Release-branch CI runs on this branch once the build is fixed and this PR is marked ready for review.
Was this PR authored or co-authored using generative AI tooling?
No.