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

How to handle incompleteRead()? #3459

Closed
haoramirez opened this Issue Jul 28, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@haoramirez

haoramirez commented Jul 28, 2016

Hi there,

How am I supposed to handle an incompleteRead?

I don't get it, because TCP is supposed to inherently prevent this right? And getting this error means that Requests, or Urllib3, somehow doesn't do checksumming properly?

I'm just way in over my head thinking about how I'm supposed to even catch it.

@Lukasa

This comment has been minimized.

Member

Lukasa commented Jul 28, 2016

Thanks for your question!

TCP is not supposed to prevent IncompleteRead. If you consider certain possible failure cases you'll see that it's impossible for TCP to prevent such a case. For example, if the server that is serving your web page is destroyed by a meteor midway through serving your web page, there is nothing TCP can do: the data is gone. The response will then necessarily be incomplete!

In most use cases, though, IncompleteRead is not caused by TCP connection problems: those will manifest as timeouts. Instead, IncompleteRead is caused when the server appears to have failed to frame it's response correctly. For example, if the server claims that it was going to send 5kB of data but only sends 4kB, we may emit this error. Or, if the server is using chunked transfer encoding and claims it will send a chunk of 40 bytes, but only 20 bytes are sent, that will also cause an IncompleteRead.

There is frequently very little you can do about this error except to log, and move on.

@Lukasa Lukasa closed this Jul 28, 2016

@haoramirez

This comment has been minimized.

haoramirez commented Jul 29, 2016

Thank you for that explanation. I didn't understand the limitations of TCP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment