Repository navigation
fix: settle rpc calls when postMessage throws instead of leaking them (#397) - #446
Merged
Merged
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by free · Input: 43.5K · Output: 1.8K · Cached: 161.7K |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #397.
Rpc.client.call()registered the pending promise and then calledtarget.postMessage(...)unguarded. The worker targets throw synchronously when the worker is terminated or in its crash-restart window (WorkerPostMessageTarget:if (!current) throw), so the pending entry was never removed nor rejected, andtarget.oncloseonly fires on actual process exit - the caller hung forever (headlessrunawaitingbackground.wait, TUIcreateWorkerFetchlooking like a freeze).call()now wraps postMessage in try/catch: on a synchronous throw it deletes the pending entry and rejects with the original error, so the failure surfaces at the call site immediately and the pending map does not grow.Tests: new case covers the throw path (rejects with the worker error) and verifies the entry is gone (a later call, once the target recovers, resolves normally). Full test/util suite 131 pass / 0 fail.