Repository navigation
ci: bound unittest-leg reimport growth and add stall diagnostics (#1052) - #1059
Conversation
- util/run_unittest_leg.py: arm faulthandler.dump_traceback_later (--stall-dump / $PCAPKIT_UNITTEST_STALL_DUMP, default 1080s) and cancel it on exit. - util/run_unittest_leg.py: gc.collect() every N tests (--gc-every, default 10), bounding re-import garbage without touching sys.modules (#981 stays visible). - pyproject.toml: pytest-timeout in the test extra; timeout = 900, method thread. - tests/conftest.py: drop the timer pytest-timeout keeps on each item, which pinned one pcapkit generation per test via the captured excepthooks. - tests/project: cover the stall dump, the collect and the conftest hook.
e8db64a to
87c229e
Compare
|
Cross-review verdict on
Non-blocking nits:
|
make pylint,make mypy,make isort) --test_isort_cleanpasses; pylint/mypy coverpcapkit/only, untouchedmake testpasses, and a test case covers the change -- new modules 11 + 3 passed (fail onmain);projectleg 466 OK;make testnot runWhat is the purpose of your pull request?
ci— workflows or build toolingDescription of your pull request and other information
Part of #1052 (A's
faulthandlerhalf, B, D). No workflow edits.A.
run_unittest_leg.pyarmsfaulthandler.dump_traceback_later(--stall-dump, or$PCAPKIT_UNITTEST_STALL_DUMP; default 1080s,0off), cancelled on exit.B, as a collect rather than a restore. Any
sys.modulesrestore hides #981. On its reproduction (32bcfba15^,test_http_unit+test_base_class_contract): no restore gives 1 F + 3 E; restoring per module or per test gives 0 + 0;gc.collect()after each test keeps 1 F + 3 E.--gc-every N(default 10).protocols/internetmeasured locally (446 tests, all OK):main, and this branch without the collect (×3)--gc-every 10(default)--gc-every 1The 1650 MiB run reproduced the slow tail:
test_mh_unittests at up to 7.3 s instead of 1.2-1.8 s.D.
pytest-timeoutintest;timeout = 900,timeout_method = "thread". The slowest test measured was 21 s, and 15× that is 315 s.signalis out because its pending alarm failsTimeLimitTests.test_nothing_is_re_armed_when_nothing_was_pending. Every pytest job already installs.[test…]. On its own,threadkilled everytestrunner at 13% (e8db64a9c). pytest-timeout keeps each item'sTimeralive, and eachTimerholds on to the tbtrim excepthooks that oneimport pcapkitinstalled, which pins that generation.tests/conftest.pynow drops the timer, andtests/constunder-n 4peaks at 1979 MiB (9179 MiB and killed before the fix, 1939 MiB without the plugin).