Skip to content

Avoid busy-spin waits in zombie cleanup lock#755

Merged
shaun0927 merged 1 commit into
developfrom
fix/754-zombie-lock-sleep
May 16, 2026
Merged

Avoid busy-spin waits in zombie cleanup lock#755
shaun0927 merged 1 commit into
developfrom
fix/754-zombie-lock-sleep

Conversation

@shaun0927
Copy link
Copy Markdown
Owner

Summary

  • Replaces the zombie-cleanup registry lock busy-spin wait with a dependency-free synchronous sleep helper.
  • Preserves existing lock retry interval, stale timeout, synchronous registry APIs, and failure behavior.
  • Adds targeted unit coverage for the wait helper and keeps cross-session zombie cleanup tests green.

Closes #754.

Direction/scope review

  • Aligned with OpenSafari simulator lifecycle reliability and CI stability.
  • Low risk: no behavior or timeout changes, only removes CPU-burning spin wait.
  • No dependencies or registry redesign.

Verification

  • npm test -- --runTestsByPath tests/unit/zombie-cleanup-lock.test.ts tests/unit/zombie-cleanup-cross-session.test.ts
  • npm run lint -- --quiet src/reliability/zombie-cleanup.ts tests/unit/zombie-cleanup-lock.test.ts
  • npm run build

Live validation after merge

  • Contend the registry lock from two OpenSafari processes and confirm the waiter does not burn a full CPU core.
  • Confirm active registered simulators remain protected from cleanup.

Constraint: Preserve synchronous registry APIs and existing lock timeout/retry semantics.
Rejected: Keep a JavaScript busy-spin loop | it wastes CPU during simulator cleanup contention.
Confidence: high
Scope-risk: narrow
Directive: Any future async lock migration should preserve active-simulator protection semantics first.
Tested: npm test -- --runTestsByPath tests/unit/zombie-cleanup-lock.test.ts tests/unit/zombie-cleanup-cross-session.test.ts; npm run lint -- --quiet src/reliability/zombie-cleanup.ts tests/unit/zombie-cleanup-lock.test.ts; npm run build
Not-tested: Live multi-process lock contention CPU profile.
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@shaun0927 shaun0927 merged commit bd5333c into develop May 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant