Author sobomax
Date 2007-01-04.21:37:50
SpamBayes Score
Marked as misclassified
The socket.readline() interface doesn't handle EINTR properly. Currently, when EINTR received exception is not handled and all data that has been in the buffer is lost. There is no way to recover that data from the code that uses the interface.

Correct behaviour would be to catch EINTR and restart recv(). Patch is attached.

Following is the real world example of how it affects httplib module:

  File "/usr/local/lib/python2.4/", line 1096, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python2.4/", line 1383, in __request
  File "/usr/local/lib/python2.4/", line 1131, in request
    errcode, errmsg, headers = h.getreply()
  File "/usr/local/lib/python2.4/", line 1137, in getreply
    response = self._conn.getresponse()
  File "/usr/local/lib/python2.4/", line 866, in getresponse
  File "/usr/local/lib/python2.4/", line 336, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python2.4/", line 294, in _read_status
    line = self.fp.readline()
  File "/usr/local/lib/python2.4/", line 325, in readline
    data = recv(1)
error: (4, 'Interrupted system call')

Date User Action Args
2007-08-23 15:56:00adminlinkissue1628205 messages
2007-08-23 15:56:00admincreate