Skip to content

OptimizedNodeBridge waitForAvailableWorker leaks timers after timeout #104

@bbopen

Description

@bbopen

Problem

waitForAvailableWorker() uses a polling loop via setTimeout(checkWorker, 10) but does not cancel the loop when the overall queue timeout fires. If the promise rejects on timeout, the polling continues indefinitely, creating a CPU/timer leak.

Evidence

  • src/runtime/optimized-node.ts: waitForAvailableWorker sets an overall timeout and then recursively schedules checkWorker without a cancellation flag.

Acceptance criteria

  • Stop polling when the queue timeout fires (e.g., set a flag and check it before rescheduling).
  • Ensure no timers remain after the promise resolves or rejects.
  • Add a test that forces queue timeout and verifies polling stops.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions