Repository navigation
test(protocols): bound the #1428 deadline test so a lost alarm cannot hang the worker (#1889) - #1891
Conversation
|
Verdict: NEEDS CHANGES at
Required:
|
ccc1e46 to
69ea9b3
Compare
|
Verdict: NEEDS CHANGES at But a
On both, Required:
|
… hang the worker (#1889) - examples/generators/options.py: each raise of _deadline re-arms the alarm for one more second until the deadline is settled. roundtrip enters it after catch_warnings, so it is torn down first, and settles it before __exit__ is entered on every way out: a `finally` around the body, and the first statement of each `except` clause, since a clause builds its outcome before the `finally` runs. __exit__ settles it too, as a backstop. A raise landing in a finaliser run by the cyclic collector, or in an `except OSError`, is dropped, and the single alarm then left the case spinning until pytest-timeout ended the xdist worker. - tests/protocols/test_option_generator_deadline_scale_1428_unit.py: _Spin gives up after SPIN_LIMIT, and the hang test then fails by name instead of hanging; new tests pin the repeat, the settled no-op, a lost alarm, SIGALRM fired on every way out of roundtrip, and the backstop. - The option captures regenerate byte-identical. Closes #1889
69ea9b3 to
437e5ad
Compare
|
Verdict: GOOD TO GO at
Unverified, as the PR says: that the lost raise is what hung CI. That was reproduced locally only. |
|
Coverage: 90.06% (unit tier, Python 3.15,
Per-file detail: the |
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Narrow runs only, listed below.Added a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseWhat happened on #1882's job 117297215943. The #1428 deadline test spun until pytest-timeout's 900s backstop ended the xdist worker. The traceback was lost because an xdist worker's stdout is
/dev/null. Another test that waits on the tier-guard lock took 882s on the same job, so the spin held that lock the whole time.Why the alarm can be lost (reproduced locally, not proven on CI). The generator's deadline is a one-shot
SIGALRM. If its singleTimeoutErroris swallowed, nothing fires again. Two things swallow it:sys.unraisablehook, for example after a long garbage collection;except OSError, becauseTimeoutErroris anOSError.Extractor.__del__catches exactly that.Fix.
examples/generators/options.py:_deadlinere-arms itself untilroundtripmarks the case settled. The option captures regenerate byte-identical.Tests. New tests cover a swallowed raise (still recorded as
'TIMEOUT'), the repeat stopping once settled, and a cleared alarm. With the generator fix reverted they fail in about 11s instead of hanging. Onmain, with a finaliser swallowing the first raise, the CI worker crash reproduces exactly. The file passes 20/20 serially and 20/20 under-n 4on Python 3.12.Closes #1889