Skip to content

OptimizedNodeBridge should block late worker spawns after dispose #102

@bbopen

Description

@bbopen

Problem

dispose() clears current workers, but spawnProcess() does not check this.disposed. If init() or spawnProcess() is in-flight while dispose() runs, a worker can be added to the pool after disposal and remain orphaned.

Evidence

  • src/runtime/optimized-node.ts: dispose() sets this.disposed = true and terminates current pool; spawnProcess() has no guard and always pushes to processPool.

Acceptance criteria

  • spawnProcess() should no-op or throw once disposed is true.
  • init() should short-circuit when disposed mid-flight.
  • Add a test that starts init(), calls dispose() quickly, and verifies no workers remain.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions