[New-bugs-announce] [issue24486] http/client.py block indefinitely on line 308 in _read_status

Julien Palard report at bugs.python.org
Mon Jun 22 15:15:11 CEST 2015

New submission from Julien Palard:

Requesting HTTP using `requests`, which uses `http.client` which use `socket`, sometimes, my program get stuck like this:

File "/usr/lib/python3.2/socket.py", line 287 in readinto
File "/usr/lib/python3.2/http/client.py", line 308 in _read_status
File "/usr/lib/python3.2/http/client.py", line 346 in begin
File "/usr/lib/python3.2/http/client.py", line 1052 in getresponse
... in python requests ...

The line is the first of _read_status::

line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")

At a lower level, the program is stuck in a `recvfrom()` syscall.

So obviously, an error at the network level caused the server to not reply, but the client recvfrom() the network in a blocking socket without checking first if data is available, so it get stuck indefinitely :-(

components: Library (Lib)
messages: 245626
nosy: Julien.Palard
priority: normal
severity: normal
status: open
title: http/client.py block indefinitely on line 308 in _read_status
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list