Skip to content
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

JSRPC: Fix waitUntil() and response streams #1901

Merged
merged 3 commits into from
Mar 27, 2024
Merged

Conversation

kentonv
Copy link
Member

@kentonv kentonv commented Mar 26, 2024

This fixes two bugs @jasnell discovered (but he's OOO this week so can't review).

Copy link
Contributor

@MellowYarker MellowYarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, though we should wait for internal CI before merging.

@kentonv kentonv force-pushed the kenton/jsrpc-response-stream branch from d2acedd to b8972c0 Compare March 27, 2024 18:57
`JsRpcCustomEventImpl` will need this. I'm surprised it wasn't provided already.
If, in an HTTP handler, you fetched a ReadableStream over RPC, and then used that ReadableStream as your HTTP response, the stream would be prematurely canceled. The problem is that the system thinks deferred proxying is possible, since we're pumping from a system stream. So, it shuts down the IoContext, thinking that no more JavaScript needs to run. However, the IoContext itself holds open the RPC context; canceling it breaks the stream.

In the future we should solve this properly s othat deferred proxying is possible. For now, we simply block deferred proxying of RPC streams.
@kentonv kentonv force-pushed the kenton/jsrpc-response-stream branch from b8972c0 to 9e9dea7 Compare March 27, 2024 20:01
@kentonv kentonv merged commit c42aec2 into main Mar 27, 2024
10 checks passed
@kentonv kentonv deleted the kenton/jsrpc-response-stream branch March 27, 2024 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants