-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The RPC request coalescer now throws exceptions whether you configure it with an AbortSignal
or not
#2910
Conversation
🦋 Changeset detectedLatest commit: 74bbe34 The changes in this PR will be included in the next version bump. 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 |
Open to other solutions just want to surface this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's almost certainly this:
return await new Promise<TResponse>((resolve, reject) => {
const handleAbort = (e: AbortSignalEventMap['abort']) => {
signal.removeEventListener('abort', handleAbort);
coalescedRequest.numConsumers -= 1;
Promise.resolve().then(() => {
if (coalescedRequest.numConsumers === 0) {
const abortController = coalescedRequest.abortController;
abortController.abort((EXPLICIT_ABORT_TOKEN ||= createExplicitAbortToken()));
}
});
reject((e.target as AbortSignal).reason);
};
signal.addEventListener('abort', handleAbort);
responsePromise.then(resolve).finally(() => {
signal.removeEventListener('abort', handleAbort);
}); // <==== this is missing a `catch(reject)`
});
When there's an abortSignal
we drop into that shim, and responsePromise's
failure case is not folded into the shim promise's reject
, so it just explodes all over the event loop.
I'm happy to fix this, but if you want to fix it, it's gonna need a realllllly good failing test!
@@ -59,7 +59,7 @@ export function getRpcTransportWithRequestCoalescing<TTransport extends RpcTrans | |||
} | |||
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, this can't possibly throw synchronously because transport()
is awaited.
… it with an `AbortSignal` or not
AbortSignal
or not
🎉 This PR is included in version 1.95.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
Summary
When an
AbortSignal
was supplied to the RPC request coalescer, it would fail to attach a rejection handler to the shim promise returned to the app.Test Plan