diff --git a/pyproject.toml b/pyproject.toml index 3d62c8b7..2c7dcb42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,6 +211,29 @@ addopts = [ # don't show frickin captured logs AGAIN in the report.. '--show-capture=no', + # sys-level capture. REQUIRED for fork-based spawn + # backends (e.g. `subint_forkserver`): default + # `--capture=fd` redirects fd 1,2 to temp files, and fork + # children inherit those fds — opaque deadlocks happen in + # the pytest-capture-machinery ↔ fork-child stdio + # interaction. `--capture=sys` only redirects Python-level + # `sys.stdout`/`sys.stderr`, leaving fd 1,2 alone. + # + # Trade-off (vs. `--capture=fd`): + # - LOST: per-test attribution of subactor *raw-fd* output + # (C-ext writes, `os.write(2, ...)`, subproc stdout). Not + # zero — those go to the terminal, captured by CI's + # terminal-level capture, just not per-test-scoped in the + # pytest failure report. + # - KEPT: Python-level `print()` + `logging` capture per- + # test (tractor's logger uses `sys.stderr`, so tractor + # log output IS still attributed per-test). + # - KEPT: user `pytest -s` for debugging (unaffected). + # + # Full post-mortem in + # `ai/conc-anal/subint_forkserver_test_cancellation_leak_issue.md`. + '--capture=sys', + # disable `xonsh` plugin # https://docs.pytest.org/en/stable/how-to/plugins.html#disabling-plugins-from-autoloading # https://docs.pytest.org/en/stable/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name diff --git a/tests/discovery/test_registrar.py b/tests/discovery/test_registrar.py index a004ddac..d87a6861 100644 --- a/tests/discovery/test_registrar.py +++ b/tests/discovery/test_registrar.py @@ -133,7 +133,7 @@ async def say_hello_use_wait( @pytest.mark.timeout( - 3, + 7, method='thread', ) @tractor_test diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index fe41dc99..27a5eee2 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -452,21 +452,8 @@ async def spawn_and_error( await nursery.run_in_actor(*args, **kwargs) -@pytest.mark.skipon_spawn_backend( - 'subint_forkserver', - reason=( - 'Passes cleanly with `pytest -s` (no stdout capture) ' - 'but hangs under default `--capture=fd` due to ' - 'pytest-capture-pipe buffer fill from high-volume ' - 'subactor error-log traceback output inherited via fds ' - '1,2 in fork children. Fix direction: redirect subactor ' - 'stdout/stderr to `/dev/null` in `_child_target` / ' - '`_actor_child_main` so forkserver children don\'t hold ' - 'pytest\'s capture pipe open. See `ai/conc-anal/' - 'subint_forkserver_test_cancellation_leak_issue.md` ' - '"Update — pytest capture pipe is the final gate".' - ), -) +# NOTE: subint_forkserver skip handled by file-level `pytestmark` +# above (same pytest-capture-fd hang class as siblings). @pytest.mark.timeout( 10, method='thread', diff --git a/tests/test_shm.py b/tests/test_shm.py index 3409f338..61bcdee2 100644 --- a/tests/test_shm.py +++ b/tests/test_shm.py @@ -16,10 +16,14 @@ from tractor.ipc._shm import ( pytestmark = pytest.mark.skipon_spawn_backend( 'subint', + 'subint_forkserver', reason=( - 'XXX SUBINT GIL-CONTENTION HANGING TEST XXX\n' - 'See oustanding issue(s)\n' - # TODO, put issue link! + 'subint: GIL-contention hanging class.\n' + 'subint_forkserver: `multiprocessing.SharedMemory` ' + 'has known issues with fork-without-exec (mp\'s ' + 'resource_tracker and SharedMemory internals assume ' + 'fresh-process state). RemoteActorError surfaces from ' + 'the shm-attach path. TODO, put issue link!\n' ) )