Skip to content

fix(pyamber, test, v1.2): stabilize flaky AtomicInteger get_and_set deadlock test - #7402

Draft
github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7295-stabilize-flaky-atomicinteger-get-and-se-v1.2
Draft

fix(pyamber, test, v1.2): stabilize flaky AtomicInteger get_and_set deadlock test#7402
github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7295-stabilize-flaky-atomicinteger-get-and-se-v1.2

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

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.

…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>
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant