[issue20611] socket.create_connection() doesn't handle EINTR properly

tholzer report at bugs.python.org
Tue May 20 06:09:06 CEST 2014


tholzer added the comment:

Here is a reproducible test case:

import threading
import signal
import os
import httplib

def killer():
    while 1:
        os.kill(os.getpid(), signal.SIGINT)

def go():
    signal.signal(signal.SIGINT, lambda x,y: None)
    thread = threading.Thread(target=killer)
    thread.start()
    while 1:
        connection = httplib.HTTPConnection("localhost:80")
        connection.connect()
        connection.close()
        
if __name__ == '__main__':
    go()

Which gives:

Traceback (most recent call last):
  File "./repro1.py", line 22, in <module>
    go()
  File "./repro1.py", line 18, in go
    connection.connect()
  File ".../lib/python2.7/httplib.py", line 757, in connect
    self.timeout, self.source_address)
  File ".../lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error:

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20611>
_______________________________________


More information about the Python-bugs-list mailing list