Document `SharedMemory` × `subint_forkserver` incompat

New `ai/conc-anal/` doc: `mp.SharedMemory` is
fork-without-exec unsafe — child inherits parent's
`resource_tracker` fd → EBADF on first shm op;
leaked `/shm_list` cascades `FileExistsError`
across parametrize variants. Canonical CPython
issue class, NOT a tractor bug. Includes two
longer-term mitigation paths (reset inherited
tracker fd vs migrate off `mp.shared_memory`).

Also, update `tests/test_shm.py`:
- comment out `subint_forkserver` from skip list
- rewrite reason with precise failure-mode
  descriptions + link to the analysis doc

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code

(cherry picked from commit c99d475d03)
(factored: dropped spawn-backend-only paths: ai/conc-anal/subint_forkserver_mp_shared_memory_issue.md)
wkt/tooling_enhancements_from_mtf_spawner
Gud Boi 2026-06-09 20:22:23 -04:00
parent 352adc64a8
commit da0c457ff7
1 changed files with 9 additions and 5 deletions

View File

@ -16,14 +16,18 @@ from tractor.ipc._shm import (
pytestmark = pytest.mark.skipon_spawn_backend(
'subint',
'subint_forkserver',
# 'subint_forkserver',
reason=(
'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'
'is fork-without-exec unsafe — child inherits parent\'s '
'`resource_tracker` fd → EBADF on first shm op '
'(`test_child_attaches_alot`); leaked `/shm_list` from '
'a "passing" run cascades into `FileExistsError` across '
'parametrize variants (`test_parent_writer_child_reader`). '
'Canonical CPython issue class, NOT a tractor bug; full '
'tracker doc:\n'
'ai/conc-anal/subint_forkserver_mp_shared_memory_issue.md'
)
)