tractor/tractor/ipc
Gud Boi aa3e230926 Fix `SharedMemory` under `subint_forkserver`
Implements the resolution described in c99d475d's
`subint_forkserver_mp_shared_memory_issue.md` (now
updated with the resolution post-mortem). Two-part
fix that side-steps `mp.resource_tracker` entirely
rather than try to make it fork-safe — turns out
that's both simpler AND more correct given tractor
already SC-manages allocation lifetimes.

Deats,
- `tractor/ipc/_mp_bs.py::disable_mantracker()`: drop the
  `platform.python_version_tuple()[:-1] >= ('3', '13')` branch — patches
  now run unconditionally:
  * monkey-patch `mp.resource_tracker. _resource_tracker` to a no-op
    `ManTracker` subclass (empty `register` / `unregister`
    / `ensure_running`).
  * return `partial(SharedMemory, track=False)` for the per-allocation
    opt-out.
  * belt + suspenders: even if something dodges the wrapper, the
    singleton can't talk to the inherited (broken) parent fd.

- `tractor/ipc/_shm.py::open_shm_list()`: drop the 3.13+ conditional
  skip of the unlink-callback; install a `try_unlink()` wrapper that
  swallows `FileNotFoundError` (sibling-already-cleaned race in
  shared-key setups). Without `mp.resource_tracker` doing it for us, we
  own the unlink — `actor. lifetime_stack` is the right place since
  tractor already controls actor lifecycle.

- `tests/test_shm.py`: uncomment-out `subint_forkserver` from the
  module-level skip- list (tests pass now). Inline comment cross-refs
  the two `_mp_bs` / `_shm` workarounds.

- `ai/conc-anal/subint_forkserver_mp_shared_memory_ issue.md`: heavy
  rewrite — flips status from "open / unresolvable in tractor" to
  "resolved, kept as decision record". Adds Resolution section, "Why
  this is the right call" rationale (mp tracker is widely criticized;
  tractor already owns lifecycle), trade-offs (crash-leaked segments,
  lost mp leak warning), verification (7 passed under both
  `subint_forkserver` and `trio` backends), and upstream issue links

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-04-27 10:51:28 -04:00
..
__init__.py Move concrete `Address`es to each tpt module 2025-07-08 18:05:05 -04:00
_chan.py Mv core mods to `runtime/`, `spawn/`, `discovery/` subpkgs 2026-04-02 17:59:13 -04:00
_fd_share.py Move concrete `Address`es to each tpt module 2025-07-08 18:05:05 -04:00
_linux.py Handle py3.14+ incompats as test skips 2026-04-23 18:47:49 -04:00
_mp_bs.py Fix `SharedMemory` under `subint_forkserver` 2026-04-27 10:51:28 -04:00
_ringbuf.py Add buf_size to RBToken and add sender cancel test, move disable_mantracker to its own _mp_bs module 2025-07-08 12:57:28 -04:00
_server.py Rename `discovery._discovery` to `._api` 2026-04-14 19:54:14 -04:00
_shm.py Fix `SharedMemory` under `subint_forkserver` 2026-04-27 10:51:28 -04:00
_tcp.py Use upstream `py-multiaddr` for `._multiaddr` 2026-04-14 19:54:14 -04:00
_transport.py Use upstream `py-multiaddr` for `._multiaddr` 2026-04-14 19:54:14 -04:00
_types.py Factor actor-embedded IPC-tpt-server to `ipc` subsys 2025-07-08 18:05:05 -04:00
_uds.py Bump UDS `listen()` backlog 1 -> 128 for multi-actor unreg 2026-04-14 19:54:15 -04:00