Skip to content

Instance graphs are never reclaimed: one task graph per unpublished spawn, one SharedError per panic — sustained panics exhaust the registry's entries table #34

Description

@lisachenko

Three merged strands converge on one missing design, each recorded in a PR body and never filed. Result slots now recycle (#16 / PR #31); the graphs whose addresses ride in those slots still accumulate until family teardown, and the registry's entries table is the first hard wall.

The evidence, from the sessions that hit it

Why it is a design, not a call

Two things stop the obvious "drop the graph when the slot record is released":

  1. Result aliasing. A task's result may reference members of the task's own graph (a task returning $this, or a sub-object it persisted). dropInstance() decrements member shares and removes zero-share objects from the registry — arena memory survives (nothing is freed), but a process that attaches the address afterwards gets "not registered". So the drop moment must be provably after every reader is done, which is exactly the capture-then-release discipline feat(parallel): give result slots back once their handle has taken the answer #31 built for slots — the question is whether the slot's release moment is also late enough for the graph, given adopters in other processes.
  2. Reclaimed entries must be usable. In arena mode, Registry::assertRegistryRoom() refuses any insert once nNumUsed == nTableSize, tombstones or not — so today, dropping entries returns registry hygiene but no capacity. The substrate half is filed as The registry room guard refuses inserts a tombstoned table could absorb, so dropping entries never returns capacity in arena mode php-shared-data-extension#28 (room-guard compact-awareness, mirroring the engine's in-place-rehash branch); this issue is blocked on it for the capacity payoff, not for the design.

Suggested shape

Acceptance criteria

  • A panic storm (say 1000 sequential panics on a default-sized registry) completes without registryTableFull, each waiter still reading its own class/message/trace.
  • A long spawn-heavy run of scalar-returning unpublished tasks plateaus in entries as it already does in slots.
  • A task whose result references its own graph is not silently broken by reclamation — asserted by a test that awaits, then attaches the result address from another process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions