Repository navigation
Allow HTTP/2 frames to be written from a fiber which is not a task - #258
Open
andrewfader wants to merge 1 commit into
Open
andrewfader wants to merge 1 commit into
andrewfader wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
The HTTP/2 connection's
write_frameandwrite_framescallTask.current.defer_stop, which raisesRuntimeError: No async task available!on a fiber that runs under the scheduler but isn't an Async task. AnEnumeratoris the common case: its fiber inherits the scheduler, so reading a response body from it works until the client needs to send a WINDOW_UPDATE (or an RST_STREAM when the body is closed early), and then the write fails.We hit this in production under Falcon: a Rack response body proxies an upstream HTTP/2 download, and the server iterates that body through an
Enumerator. Downloads failed a few MB in, once the client's window needed extending.With no task there is nothing to defer stopping, so the writes now use
Task.current?and write directly when it's nil.The new test reads a 10 MB response through an
Enumerator. Without the change it fails withNo async task available!fromInput#read→request_window_update→write_frame; with it the whole body is read.bundle exec sus(276 passed, 3 skipped) andbundle exec rubocopare clean.