fix(tests): prevent xdist worker OOM from leaked tarpit asyncio task
asyncio_default_fixture_loop_scope was 'module', so all async tests in a module share one event loop. test_lifespan_startup_and_shutdown patched log_ingestion_worker/log_collector_worker/attacker_profile_worker but not tarpit_watcher_worker — the real while-True coroutine was created as an asyncio task on the shared loop and never cancelled. The xdist worker ran for 4+ hours (confirmed via py-spy + etime=04:48) consuming 15+ GB before OOM-kill. Fixes: - Patch tarpit_watcher_worker in both TestLifespan tests - Change asyncio_default_fixture_loop_scope to 'function' so each test gets its own loop; tasks cannot outlive their test - Add loop_scope='module' to precision_engine which legitimately needs a module-scoped event loop
This commit is contained in:
@@ -116,7 +116,7 @@ decnet = "decnet.cli:app"
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
asyncio_debug = "true"
|
||||
asyncio_default_fixture_loop_scope = "module"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
addopts = "-v -q -x -n 4 --dist load"
|
||||
norecursedirs = [
|
||||
"tests/live",
|
||||
|
||||
Reference in New Issue
Block a user