-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
consumeEachBufferRange completes successfully on connection abort #1797
Comments
Hi @fluidsonic, I'm trying to reproduce the issue, but I always get PS: I also tested it on Android where I got |
I've tested on a Google Pixel 2 with Android 10 now (EDGE connection) and have the same problem there. It seems to be related to the workaround for issue #1708 as I cannot reproduce it without Test code:
Output:
|
Thanks, @fluidsonic, I managed to reproduce it with |
Well, I spent time trying to understand what's the reason and finally realized that the issue is not reproduced using the current ktor master branch, only version |
That's a good thing, I guess? Is this bug actually unit-testable? |
Hi @fluidsonic, I'm also not sure how to simulate this. An additional issue is that the behavior we'd like to test is reproduced only on Android. |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
This issue is still persistent on ktor 1.5.2 Any solutions for it? |
Ktor Version and Engine Used
Ktor Client 1.3.2 with OkHttpClient 4.5.0 on Android 21
Describe the bug
When the connection dies during a streaming download,
consumeEachBufferRange
erroneously completes successfully.To Reproduce
consumeEachBufferRange
.visitor
I've passed toconsumeEachBufferRange
will be called with abuffer
object that has0
remaining bytes andlast
set totrue
. The latter, to my knowledge, indicates download completion.IOException
is thrown which further indicates that the download has completed.consumeEachBufferRange
invocations) isn't even close to the number of bytes indicated in theContent-Length
header.Note that it doesn't happen 100% of the time.
Sometimes I do get a shorter packet (e.g. 64 bytes instead of a typical 4088 byte packet) with
last = false
plus aSocketTimeoutException
afterwards.Expected behavior
consumeEachBufferRange
shouldn't be called with a0
byte buffer.consumeEachBufferRange
shouldn't be called withlast = true
for an aborted connection.consumeEachBufferRange
should throw anIOException
for an aborted connection.The text was updated successfully, but these errors were encountered: