Skip to content

fix(core): reject pending promises directly when plugin worker exits unexpectedly#34588

Merged
FrozenPandaz merged 1 commit intomasterfrom
fix/isolated-plugin-shutdown
Feb 24, 2026
Merged

fix(core): reject pending promises directly when plugin worker exits unexpectedly#34588
FrozenPandaz merged 1 commit intomasterfrom
fix/isolated-plugin-shutdown

Conversation

@AgentEnder
Copy link
Copy Markdown
Member

When a plugin worker process exits unexpectedly, the exit handler previously sent synthetic loadResult messages to all pending response handlers. If any handler was waiting for a different result type (e.g. createNodesResult), the type validation would reject with a confusing "Expected createNodesResult, got loadResult" error instead of surfacing the actual cause.

Split response handlers into onMessage / onError callbacks so the exit handler can reject each pending promise directly with a clear "Plugin worker exited unexpectedly" error.

Also use unique transaction IDs for load messages (via generateTxId) to avoid potential handler overwrites during worker restarts.

Fixes #34564

…unexpectedly

When a plugin worker process exits unexpectedly, the exit handler previously
sent synthetic `loadResult` messages to all pending response handlers. If any
handler was waiting for a different result type (e.g. `createNodesResult`),
the type validation would reject with a confusing "Expected createNodesResult,
got loadResult" error instead of surfacing the actual cause.

Split response handlers into `onMessage` / `onError` callbacks so the exit
handler can reject each pending promise directly with a clear
"Plugin worker exited unexpectedly" error.

Also use unique transaction IDs for `load` messages (via `generateTxId`)
to avoid potential handler overwrites during worker restarts.

Fixes #34564
@AgentEnder AgentEnder requested a review from a team as a code owner February 24, 2026 20:51
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 24, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 60e1618
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/699e0f527d90ea00086b2c77
😎 Deploy Preview https://deploy-preview-34588--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Feb 24, 2026

View your CI Pipeline Execution ↗ for commit 60e1618

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 47m 33s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 12s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-24 21:43:31 UTC

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 24, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 60e1618
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/699e0f520ad1af0008e381ab
😎 Deploy Preview https://deploy-preview-34588--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@FrozenPandaz FrozenPandaz merged commit 1ecf0fb into master Feb 24, 2026
24 checks passed
@FrozenPandaz FrozenPandaz deleted the fix/isolated-plugin-shutdown branch February 24, 2026 22:44
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
…unexpectedly (#34588)

When a plugin worker process exits unexpectedly, the exit handler
previously sent synthetic `loadResult` messages to all pending response
handlers. If any handler was waiting for a different result type (e.g.
`createNodesResult`), the type validation would reject with a confusing
"Expected createNodesResult, got loadResult" error instead of surfacing
the actual cause.

Split response handlers into `onMessage` / `onError` callbacks so the
exit handler can reject each pending promise directly with a clear
"Plugin worker exited unexpectedly" error.

Also use unique transaction IDs for `load` messages (via `generateTxId`)
to avoid potential handler overwrites during worker restarts.

Fixes #34564

(cherry picked from commit 1ecf0fb)
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
…unexpectedly (#34588)

When a plugin worker process exits unexpectedly, the exit handler
previously sent synthetic `loadResult` messages to all pending response
handlers. If any handler was waiting for a different result type (e.g.
`createNodesResult`), the type validation would reject with a confusing
"Expected createNodesResult, got loadResult" error instead of surfacing
the actual cause.

Split response handlers into `onMessage` / `onError` callbacks so the
exit handler can reject each pending promise directly with a clear
"Plugin worker exited unexpectedly" error.

Also use unique transaction IDs for `load` messages (via `generateTxId`)
to avoid potential handler overwrites during worker restarts.

Fixes #34564

(cherry picked from commit 1ecf0fb)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expected createNodesResult, got loadResult with @nx/docker plugin

2 participants