Repository navigation
tests: four merge-queue flakes wait on the event, not on timing - #3581
Conversation
test_cut_off_waiters_never_start_a_second_call_on_a_hung_connection assumed each of its three dispatches reaches its lookup inside the 4.0s wall cap. On a loaded windows-2025 runner (CI run 46863103581) the first dispatch's cap fired before its worker sent the lookup (kill cause wall_cap, not wall_cap_lookups), so dispatch B became the hung call and only C refused: `assert 1 == 2` on the refusing helpers. A dispatch that served nothing proves nothing either way, so the test now sends it again until the visible effect it is there for appears: a runner call for A, one more refusing helper for B and for C, within a 30s budget inside the watchdog. Each dispatch must still hit the cap, and the guarded property is checked after every dispatch: no second runner call on the hung connection. A temporary mutation that skips the per-connection record (B calls the runner) fails the test. Verified-by: tests
… truncation test_the_TEARDOWN_ends_a_SUSPENDED_process_frozen_before_it_ran failed to arm on ubuntu (CI run 46868850826): "the teardown census did not see the frozen process". The census skips processes created before `since`, set 1.0s below time.time(). On Linux psutil reads a creation time as /proc/stat's btime, truncated by the kernel to whole seconds, plus the start time truncated to clock ticks, so a process can read up to about 1.01s early. One started within a tick of the cut reads as older, and psutil caches that value, so every poll for 15s skipped it. The census, the token fixture's teardown census and the import cut now start CENSUS_MARGIN (3.0s) back. The needles (token, sleeper mark, temporary directory) alone tie a process to its test, so the wider window admits no other test's process, and the test still requires the census to see the frozen process before it asserts the reap. Verified-by: tests Verified-by: code-review xhigh
test_a_retried_close_waits_on_the_close_already_in_flight read database._CLOSING right after `await asyncio.wait_for(retry, WAIT)`. The close drops its entry in a done callback queued when wait_closed ends. On a loaded windows-2025 runner (CI run 46876329705) the retry's 0.1s tick timer woke it in the same loop pass, ahead of the close's last step, so the retry ended before that callback ran. The test task, woken by the send in that pass, found `retry` already done, the await returned without yielding, and the read saw the entry: "a finished close is still tracked". The test now polls with the shared wait_until (up to WAIT) for the entry to go. Removing the _forget_close callback in a temporary local mutation still fails the test. Verified-by: tests
test_scp_stop_runs_off_loop_and_lets_in_flight_cstore_finish timed out on ubuntu (CI run 46854824199) waiting 15s for its SCU thread. The SCP is stopping when the SCU releases, so it ends that release with an abort at once. pynetdicom 3.0.4's requestor can lose the abort: release() pauses the reactor by trusting _is_paused, which still reads True for the reactor send_c_store has just woken, and that reactor's next pass takes the abort off the queue. release() then waits out the SCU's 30s ACSE timeout. A local induction (requestor reactor 50 ms late to its abort check, release waiter 200 ms late) reproduces the CI TimeoutError with the old helper and passes with this change. The test's SCU is now an inline copy of _scu_cstore that ends with an abort, kept inside this test's body so it merges cleanly with PR 3556's edits to the helper. The C-STORE status is read before the SCU ends, so every claim holds: a stop that aborts the in-flight association (a temporary local mutation calling AE.shutdown) still fails the test. Verified-by: tests
|
Lander (session heuristic-kepler, account 7): independent Lander-started review of this Lander-built PR (fork aee3f4fa814451266, round-71e0c9a4d3): One finding makes a test weaker than on main: the DICOM stop test's SCU now ends with abort, so nothing exercises a peer A-RELEASE to a stopping SCP. On main that path was reached only as a side effect, and its only signal was a hang that could not be told from the pynetdicom 3.0.4 requestor race this PR avoids. Decision d20261202T140825539-874b57 (class B): merge and file it. Undo: revert the squash commit. Queued for filing under R2 (one row): a raw-socket SCU test that sends A-RELEASE-RQ after the C-STORE-RSP and bounds stop(); the sandbox phase predicates use absolute counts (use a per-phase snapshot); the 30 s sandbox budget ignores the respawn outside the cap; Pinned head for the merge: 2358f14. I enqueue once every required context is green on it. |
Tests only; no product code changed. Built by a Lander Builder under the owner's instruction to fix the flaky queue tests. Each of these four tests failed once today on a PR that does not touch it, and each failure removed a PR from the merge queue.
tests/test_sandbox_isolated.py, run 46863103581): re-sends a dispatch that served nothing because its worker or helper came after the cap, up to a 30 s budget. It checks for no second runner call after every dispatch.tests/test_durability_hook_push_bound.py, run 46868850826): the census starts 3 s back, because psutil on Linux reads creation times up to about 1.01 s early from btime truncation.tests/test_backlog2394_database_gate.py, run 46876329705): polls for the close's done callback rather than reading_CLOSINGin the same loop pass.tests/test_dicom_scp.py, run 46854824199): its SCU ends with an abort, because pynetdicom 3.0.4's requestorrelease()can lose the stopping SCP's abort and wait out its 30 s ACSE timeout. A local induction reproduced the CI TimeoutError.Each fix was checked with a temporary product mutation that makes the test fail; every mutation was reverted.
Checks run: ruff check, ruff format --check and mypy (linux, tests profile) on the four files; the four files together, 92 passed; each changed test 5 of 5 on Windows. Not run: the full suite, the product mypy legs, e2e-smoke. The durability fix's failing path is Linux-only and was not exercised locally. Legs to read: ubuntu
testfor the durability and DICOM tests, windows-2025 for the sandbox and close tests.QA (Builder's own): Level xhigh. Rounds: 2 + 1 unrepaired (round-9a71c4e2b6, round-3c58e1f07a, round-e4b71d0c95). The Builder did not read the tags with review_tag.py, so this is not the review proof; the Lander starts an independent review on this head.
Open findings from the unrepaired round:
assoc.abort()is not guarded byis_established.await asyncio.sleep(0)would be exact where the 5 s poll is loose.Product finding to file, not fixed here:
DicomScuDestination._releaseinmessagefoundry/transports/dicom.pyhas the same pynetdicom release race, so a peer that answers a release with an abort would hold the delivery worker fortimeout_secondsafter a store that already succeeded.