Skip to content

test: fake child processes can be signalled before they install their SIGTERM handler #282

Closed

Description

@ElbertePlinio

Found while fixing #265 (PR #281).

The #265 flake came from a node -e fake that installs its SIGTERM handler only after Node starts up, while the test waited a fixed 100 ms. Under load, Node startup took 90 to 140 ms, so the fake died from the default SIGTERM action before it recorded anything. PR #281 fixed that one test with a ready file that the fake writes after it installs its handler.

Other tests also install SIGTERM handlers in fake child processes and may wait a fixed time or not at all. They were not audited:

  • packages/core/test/proc.test.ts
  • packages/desktop-linux/test/viewer.test.ts
  • packages/desktop-linux/test/integration.test.ts
  • packages/browser/test/devtools-mcp.test.ts
  • packages/cli/test/viewer-fakes.ts
  • packages/cli/test/browser-session.test.ts
  • packages/cli/test/browser-command-process.test.ts
  • packages/cli/test/watch.test.ts

A review of #281 also noted a pre-existing gap in packages/core/test/session.test.ts around lines 1016-1022: the pid === undefined check throws before the try, so if one spawn fails, the other fakes are not killed.

  • Audit each listed fake for signals sent before its handler exists
  • Use a readiness signal (ready file or stdout line) where a test depends on the handler
  • Move spawn checks inside the cleanup scope in session.test.ts
  • Repeat-run evidence under load

Activity

  1. added
    bug
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions