-
Notifications
You must be signed in to change notification settings - Fork 117
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
AHC crashes with HTTP2 when uploading a big body when channel & delegate live on separate EventLoops #784
Comments
FWIW, the crash looks like so
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a pretty fun bug: In (at least) HTTP2 mode, when uploading a huge body, AHC behaves badly in various different ways.
The writes (in a recursive loop) are run in a recursive loop and they are freewheeling meaning there is no real backpressure.
Specifically in
async-http-client/Sources/AsyncHTTPClient/RequestBag.swift
Lines 187 to 188 in bdaa3b1
write
promise but rather a pre-succeeded future. This won't stop until the state machine switches into a mode to "pause" sending the request body.The problem is twofold:
channelWritabilityChanged -> false
which of course happens on the channel's EL. But the writes are triggered on the delegate's EL... (That's bad usually not fatal, we're just eating up some extra memory)async-http-client/Sources/AsyncHTTPClient/HTTPHandler.swift
Lines 58 to 69 in bdaa3b1
O(bodySize / 4MB)
recursive stack frames. 5 GB always does the job.The text was updated successfully, but these errors were encountered: