Skip to content

tests: keep GC pauses out of the node-deadline timing window - #54

Merged
DaveHomeAssist merged 1 commit into
mainfrom
claude/deadline-test-gc
Oct 2, 2026
Merged

DaveHomeAssist merged 1 commit into
mainfrom
claude/deadline-test-gc

Conversation

@DaveHomeAssist

Copy link
Copy Markdown
Owner

Problem

tests/test_node_deadlines.py::test_complete_deadline_interrupts_real_http_reads[503-body] failed on every Python 3.14 CI run of #51 (attempts 1 and 2) and #52 (attempts 1 and 2). It took 0.83–0.99 s against its 0.7 s bound. main, #47 and #53 passed. All runs used CPython 3.14.7, and the test passes alone locally.

The cause is a garbage-collection pause, not the deadline code. A local full suite on 3.14 with a gc.callbacks probe logged 31 collections over 30 ms: up to 1.04 s for gen 2 and 0.5–0.7 s for several gen 1 passes. Those pauses are larger than the 0.45 s of slack between TOTAL (0.25 s) and UPPER_BOUND (0.7 s). Collections fall at deterministic points in the suite, and the tests #51 and #52 add moved one into [503-body].

Change

slow_node disables automatic GC while its server is up and restores the previous state on exit. That covers every timed assertion in this file, including the error_headers case, which has only 0.25 s of slack. Deadline code, TOTAL, UPPER_BOUND and the server stall times are unchanged, so the tests still prove the same bounds.

Checks

  • pytest -q tests/test_node_deadlines.py: 13 passed.
  • Full suite with the GC probe: see the follow-up comment.
  • git diff --check: clean.

After this merges, #51 and #52 need main merged in to rerun CI.

On Python 3.14 a full-suite collection pause can run 0.5-1 s, more than
the 0.45 s slack between the 0.25 s deadline and the 0.7 s bound. One
landed in test_complete_deadline_interrupts_real_http_reads[503-body] on
every 3.14 run of #51 and #52 (0.83-0.99 s), whose extra tests shift
where collections fall. slow_node now disables automatic GC while its
server is up and restores the previous state afterwards. Deadline code
and bounds are unchanged.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@DaveHomeAssist

Copy link
Copy Markdown
Owner Author

Local full suite on this branch (Python 3.14.3, with the gc.callbacks probe): 757 passed, 1 skipped. The probe logged 28 collections over 30 ms elsewhere in the suite (up to 0.57 s, gen 2), and 0 inside test_node_deadlines.py. The same probe on #52's tree before the fix: 31 collections over 30 ms, up to 1.04 s.

@DaveHomeAssist
DaveHomeAssist merged commit d08f638 into main Oct 2, 2026
3 checks passed
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