Skip to content

fix(platform-node-shared): keep a proxy process whose reply waits behind a blocked event loop - #11008

Open
juliusmarminge wants to merge 7 commits into
Effect-TS:mainfrom
juliusmarminge:proxy-process-lifecycle
Open

juliusmarminge wants to merge 7 commits into
Effect-TS:mainfrom
juliusmarminge:proxy-process-lifecycle

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

layerProxyProcess stops the proxy process when a reply takes longer than responseTimeout. That can kill a healthy proxy process when the application's own event loop is blocked. If the loop is blocked past the deadline right after a spawn request is sent, Node runs the due timer before it reads the proxy process's reply, which is already waiting on the IPC channel. The spawn then fails, and every command the proxy process was running loses its exit status.

With this change, a request's responseTimeout timer no longer stops the proxy process directly. It schedules a setImmediate, which runs after Node has read any queued replies, and the proxy process is stopped only if that request's timer is still registered. The timer stays unref'd. The immediate is referenced, so an idle event loop runs it straight away instead of waiting for unrelated I/O.

Deadlines are still per request. Messages for other commands do not extend a missing reply's timeout, and a silent proxy process still times out on schedule.

Test

  • keeps a proxy process whose reply waits behind a blocked event loop starts a spawn with a 1 s responseTimeout, blocks the event loop with Atomics.wait until the child has started and the deadline has passed, then asserts that the spawn succeeds and a second spawn reuses the same proxy process.
  • does not send a command again when its acknowledgement is lost now also runs unrelated spawns on the same proxy process during the timeout window, to check that they do not keep the unanswered request alive.

Closes EFF-4636

…ind a blocked event loop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 02c8d1e

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

This PR includes changesets to release 40 packages
Name Type
@effect/platform-node-shared Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-cloudflare 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/graphql-generator 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

@effect-janitor effect-janitor Bot added the 4.0 label Nov 27, 2026
@github-actions

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 40.28 KB 40.28 KB 0.00 KB (0.00%)
basic.ts 6.60 KB 6.60 KB 0.00 KB (0.00%)
batching.ts 11.65 KB 11.65 KB 0.00 KB (0.00%)
brand.ts 7.17 KB 7.17 KB 0.00 KB (0.00%)
cache.ts 11.83 KB 11.83 KB 0.00 KB (0.00%)
config.ts 23.75 KB 23.75 KB 0.00 KB (0.00%)
differ.ts 22.55 KB 22.55 KB 0.00 KB (0.00%)
http-client.ts 28.40 KB 28.40 KB 0.00 KB (0.00%)
http-router.ts 39.10 KB 39.10 KB 0.00 KB (0.00%)
logger.ts 12.26 KB 12.26 KB 0.00 KB (0.00%)
metric.ts 9.91 KB 9.91 KB 0.00 KB (0.00%)
optic.ts 7.43 KB 7.43 KB 0.00 KB (0.00%)
pubsub.ts 16.55 KB 16.55 KB 0.00 KB (0.00%)
queue.ts 13.44 KB 13.44 KB 0.00 KB (0.00%)
schedule.ts 12.27 KB 12.27 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.32 KB 14.32 KB 0.00 KB (0.00%)
schema-binary.ts 43.17 KB 43.17 KB 0.00 KB (0.00%)
schema-class.ts 22.31 KB 22.31 KB 0.00 KB (0.00%)
schema-codegen.ts 33.66 KB 33.66 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.76 KB 30.76 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.49 KB 28.49 KB 0.00 KB (0.00%)
schema-string-transformation.ts 16.06 KB 16.06 KB 0.00 KB (0.00%)
schema-string.ts 12.60 KB 12.60 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.62 KB 16.62 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.82 KB 39.82 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.44 KB 21.44 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.62 KB 21.62 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.71 KB 21.71 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.75 KB 26.75 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.77 KB 21.77 KB 0.00 KB (0.00%)
schema.ts 21.41 KB 21.41 KB 0.00 KB (0.00%)
stm.ts 14.77 KB 14.77 KB 0.00 KB (0.00%)
stream.ts 10.56 KB 10.56 KB 0.00 KB (0.00%)
supervisor.ts 11.85 KB 11.85 KB 0.00 KB (0.00%)

This branch is waiting to be deployed

1 waiting deployment
fork — 02c8d1e9 Waiting Nov 28, 2026 by effect-bot via approval-gate #27820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants