Skip to content

Wait for inherited stdio close in NodeChildProcessSpawner release and kill - #7875

Closed
xia-chao wants to merge 4 commits into
Effect-TS:mainfrom
xia-chao:fix/childprocess-close-wait-7821
Closed

xia-chao wants to merge 4 commits into
Effect-TS:mainfrom
xia-chao:fix/childprocess-close-wait-7821

Conversation

@xia-chao

@xia-chao xia-chao commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

NodeChildProcessSpawner already signals the process group on scoped release and kill, but it waited on the leader's exit. On Linux, shell: true uses dash (sh -c), which does not exec the command. SIGTERM kills the shell immediately, exit fires, forceKillAfter is dropped, and descendants keep running.

Release and kill now wait for the Node close event (inherited stdio released). Public exitCode / isRunning still use exit.

Fixes #7821

Test plan

  • vitest --run packages/platform/node-shared/test/NodeChildProcessSpawner.test.ts
  • Linux shell: true scope close does not return until the wrapper and its inherited-stdio child have printed *:SIGTERM
  • macOS (bash execs) still completes the same wait
  • exitCode / isRunning remain bound to the leader exit event

… kill

A non-exec'ing shell leader can exit before descendants, so scoped release and kill now await the Node close event instead of the leader exit.
@changeset-bot

changeset-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cf9902a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@effect/platform-node-shared Patch
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 34.05 KB 34.05 KB 0.00 KB (0.00%)
basic.ts 7.15 KB 7.15 KB 0.00 KB (0.00%)
batching.ts 10.38 KB 10.38 KB 0.00 KB (0.00%)
brand.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
cache.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
config.ts 21.75 KB 21.75 KB 0.00 KB (0.00%)
differ.ts 20.55 KB 20.55 KB 0.00 KB (0.00%)
http-client.ts 22.20 KB 22.20 KB 0.00 KB (0.00%)
http-router.ts 32.90 KB 32.90 KB 0.00 KB (0.00%)
logger.ts 11.12 KB 11.12 KB 0.00 KB (0.00%)
metric.ts 9.28 KB 9.28 KB 0.00 KB (0.00%)
optic.ts 6.87 KB 6.87 KB 0.00 KB (0.00%)
pubsub.ts 15.49 KB 15.49 KB 0.00 KB (0.00%)
queue.ts 12.09 KB 12.09 KB 0.00 KB (0.00%)
schedule.ts 11.20 KB 11.20 KB 0.00 KB (0.00%)
schema-binary.ts 39.70 KB 39.70 KB 0.00 KB (0.00%)
schema-class.ts 20.32 KB 20.32 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.48 KB 30.48 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 26.41 KB 26.41 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.89 KB 13.89 KB 0.00 KB (0.00%)
schema-string.ts 11.38 KB 11.38 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.76 KB 15.76 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 33.59 KB 33.59 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.76 KB 24.76 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 19.51 KB 19.51 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 19.65 KB 19.65 KB 0.00 KB (0.00%)
schema-toFormatter.ts 19.77 KB 19.77 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 23.84 KB 23.84 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.79 KB 19.79 KB 0.00 KB (0.00%)
schema.ts 19.53 KB 19.53 KB 0.00 KB (0.00%)
stm.ts 13.03 KB 13.03 KB 0.00 KB (0.00%)
stream.ts 10.06 KB 10.06 KB 0.00 KB (0.00%)

@tim-smart

Copy link
Copy Markdown
Contributor

Already fixed on main

@tim-smart tim-smart closed this Sep 4, 2026

This branch had an error being deployed

1 failed deployment
fork — cf9902a8 Deployed Sep 4, 2026 by xia-chao via approval-gate #14090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

platform-node-shared: scoped release and kill wait on the leader's exit, abandoning descendants when the leader is a non-exec'ing shell (Linux sh -c)

2 participants