This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月13日 01:31 by nikratio, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| http_truncated_body.patch | pitrou, 2013年01月30日 20:57 | |||
| Messages (14) | |||
|---|---|---|---|
| msg168068 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2012年08月13日 01:31 | |
Occasionally, the isclosed() method of HTTPResponse instances returns False, even though a preceding read() call returned '' (or something else that evalues to False). This is a problem, because then the corresponding HTTPConnection can still be used to send another request, but an attempt to retrieve its response result it in ResponseNotReady() exception. I have not found anything special about the requests for which this happens. I also looked at the httplib code and found no way for this to happen, but obviously I am missing something. Maybe someone more familiar with the codebase can tell what's happening there. The problem happens to rarely to be able to run packet capture, but I can provide attributes of the relevant httplib instances if desired. |
|||
| msg168095 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年08月13日 12:42 | |
Without a reproducible test case I doubt we are going to be able to solve this, but yes please provide what information you can for the record, in case someone else runs in to it in a more reproducible situation. |
|||
| msg168147 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2012年08月13日 21:30 | |
The problem seems to occur regularly, just with large intervals in between. Is there any specific information that might help here? I am not quite sure what to save when the problem happens the next time. Can the response object be pickled? |
|||
| msg168153 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年08月13日 22:06 | |
Do you call read() or read(<some length>)? Please inspect at least the "fp", "length", "chunked" and "chunk_left" attributes. |
|||
| msg168197 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2012年08月14日 12:56 | |
The call should be read(size), with size a number. I will make sure to check size, "fp", "length", "chunked" and "chunk_left" when it happens the next time. |
|||
| msg173514 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2012年10月22日 13:22 | |
This is just a heads-up that I'm still trying to debug this. So far, the problem doesn't seem to have shown up again (for reference, the original report for this is http://code.google.com/p/s3ql/issues/detail?id=358). |
|||
| msg173515 - (view) | Author: Piotr Dobrogost (piotr.dobrogost) | Date: 2012年10月22日 13:29 | |
@Nikolaus Issue 16298 was raised today describing what could be the cause of what you observe. |
|||
| msg180959 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2013年01月30日 01:37 | |
Alright, it *finally* happened again. Attributes of the response object are: ._method: GET, .chunked: 0, .length: 9369540 .chunk_left: UNKNOWN, .status: 200 .reason "OK", .version: 11, .will_close: False |
|||
| msg180966 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年01月30日 07:23 | |
"length: 9369540" indicates you haven't read the whole advertised Content-Length. Is it possible the server shuts down the TCP connection even before the whole Content-Length has been sent? |
|||
| msg180992 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年01月30日 20:57 | |
Here is a patch for 2.7. Ideally, we would raise IncompleteRead in this situation, but this would break existing programs. |
|||
| msg181219 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年02月02日 21:52 | |
New changeset 8dcf94c2fef5 by Antoine Pitrou in branch '2.7': Issue #15633: httplib.HTTPResponse is now mark closed when the server sends less than the advertised Content-Length. http://hg.python.org/cpython/rev/8dcf94c2fef5 |
|||
| msg181220 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年02月02日 22:10 | |
New changeset 03c536afeb7e by Antoine Pitrou in branch '3.2': Issue #15633: httplib.HTTPResponse is now mark closed when the server sends less than the advertised Content-Length. http://hg.python.org/cpython/rev/03c536afeb7e New changeset 7d504068bc58 by Antoine Pitrou in branch '3.3': Issue #15633: httplib.HTTPResponse is now mark closed when the server sends less than the advertised Content-Length. http://hg.python.org/cpython/rev/7d504068bc58 New changeset 9f9287357af9 by Antoine Pitrou in branch 'default': Issue #15633: httplib.HTTPResponse is now mark closed when the server sends less than the advertised Content-Length. http://hg.python.org/cpython/rev/9f9287357af9 |
|||
| msg181221 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年02月02日 22:14 | |
I've committed the patch into 2.7 and then ported it to 3.x. Please reopen if the problem still occurs with the patch. |
|||
| msg181238 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2013年02月03日 03:39 | |
On 01/29/2013 11:23 PM, Antoine Pitrou wrote: > "length: 9369540" indicates you haven't read the whole advertised Content-Length. Is it possible the server shuts down the TCP connection even before the whole Content-Length has been sent? The remote server isn't under my control, so I can't say for sure. But I guess the connection could be terminated prematurely for quite a number of reasons, so if that causes trouble for httplib then this might well be the problem. Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:34 | admin | set | github: 59838 |
| 2013年02月03日 03:39:05 | nikratio | set | messages: + msg181238 |
| 2013年02月02日 22:14:07 | pitrou | set | status: open -> closed resolution: fixed messages: + msg181221 stage: patch review -> resolved |
| 2013年02月02日 22:10:31 | python-dev | set | messages: + msg181220 |
| 2013年02月02日 21:52:37 | python-dev | set | nosy:
+ python-dev messages: + msg181219 |
| 2013年01月30日 20:57:44 | pitrou | set | files:
+ http_truncated_body.patch versions: + Python 3.2, Python 3.3, Python 3.4 messages: + msg180992 keywords: + patch stage: patch review |
| 2013年01月30日 07:23:44 | pitrou | set | messages: + msg180966 |
| 2013年01月30日 01:37:06 | nikratio | set | messages: + msg180959 |
| 2012年10月22日 13:29:59 | piotr.dobrogost | set | messages: + msg173515 |
| 2012年10月22日 13:22:47 | nikratio | set | messages: + msg173514 |
| 2012年10月22日 08:41:52 | piotr.dobrogost | set | nosy:
+ piotr.dobrogost |
| 2012年08月14日 12:56:01 | nikratio | set | messages: + msg168197 |
| 2012年08月13日 22:06:38 | pitrou | set | nosy:
+ pitrou messages: + msg168153 |
| 2012年08月13日 21:58:20 | pitrou | set | nosy:
+ orsenthil |
| 2012年08月13日 21:30:35 | nikratio | set | messages: + msg168147 |
| 2012年08月13日 12:42:52 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg168095 |
| 2012年08月13日 01:31:03 | nikratio | create | |