tractor/tractor/spawn
Gud Boi 2c0fefef61 Add `tractor.spawn._reap.unlink_uds_bind_addrs()`
Inside a new new `tractor.spawn._reap` submod which kicks off providing
post-mortem subactor cleanup primitives, parent-side; consider it the
"sibling" of `tractor._testing._reap` which is the test-harness-oriented
brother mod.

Today: `unlink_uds_bind_addrs()` provides a starter bug-fix for #454
where `hard_kill()`'s `SIGKILL` bypasses the subactor's
`_serve_ipc_eps`-`finally:` `os.unlink(addr.sockpath)`, leaking
`${XDG_RUNTIME_DIR}/tractor/<name>@<pid>.sock` files..

This adds 2 cleanup paths:
- explicit `bind_addrs` (when set at spawn time),
OR
- convention-based reconstruction from `subactor.aid.name + proc.pid`
  for the random-self-assign case.

`.spawn.hard_kill()` now invokes the cleanup unconditionally
post-`SIGKILL`; graceful-exit case is a no-op via `FileNotFoundError`
skip.

Future work — authoritative tracking via a per-process
UDS bind-addr registry — documented in module docstring,
deferred to a follow-up PR.

Co-fix: `tractor/spawn/_trio.py::new_proc` already passes
`bind_addrs` + `subactor` to `hard_kill` via prior work
on this branch.

(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 e9712dcaeb)

(factored: the tractor/_testing/_reap.py harness hunk rides with the testing-harness segment instead)
2026-06-09 23:07:44 -04:00
..
__init__.py Restore fn-arg `_runtime_vars` in `trio_proc` teardown 2026-04-23 18:30:11 -04:00
_entry.py Tidy `spawn/` subpkg docstrings and imports 2026-04-17 19:03:00 -04:00
_forkserver_override.py Mv core mods to `runtime/`, `spawn/`, `discovery/` subpkgs 2026-04-02 17:59:13 -04:00
_mp.py Tidy `spawn/` subpkg docstrings and imports 2026-04-17 19:03:00 -04:00
_mp_fixup_main.py Fix typos + typing in `_mp_fixup_main` 2026-04-10 20:58:54 -04:00
_reap.py Add `tractor.spawn._reap.unlink_uds_bind_addrs()` 2026-06-09 23:07:44 -04:00
_spawn.py Add `tractor.spawn._reap.unlink_uds_bind_addrs()` 2026-06-09 23:07:44 -04:00
_trio.py Add `tractor.spawn._reap.unlink_uds_bind_addrs()` 2026-06-09 23:07:44 -04:00