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

2015-04-07 Thread Gregory P. Smith
Gregory P. Smith added the comment: i'm moving this to the more recent issue as i like the patch in that one better. -- superseder: - Fix EINTR Socket Module issues in 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611

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

2015-04-07 Thread Gregory P. Smith
Changes by Gregory P. Smith g...@krypto.org: -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2015-04-06 Thread STINNER Victor
STINNER Victor added the comment: This issue was fixed in Python 3.5 as part of the PEP 475: see issue #23618 which modified socket.socket.connect() to handle EINTR. It's not as simple as retrying connect() in a loop. You must respect the socket timeout (it's better to have a monotonic clock

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

2015-02-07 Thread Martin Panter
Martin Panter added the comment: See also PEP 475 and Issue 23285 for the general fix in Python 3 -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-07-24 Thread STINNER Victor
STINNER Victor added the comment: The issue is just an example of the main issue #18885 which proposes to retry interrupted syscalls. I hesitate to mark it as duplicate, but it contains an interesting patch. -- ___ Python tracker

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

2014-06-03 Thread Gregory P. Smith
Gregory P. Smith added the comment: Something like the patch i'm attaching to socketmodule.c is what I would prefer. I haven't looked at or tried tests for it yet. -- assignee: - gregory.p.smith keywords: +patch Added file:

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

2014-06-03 Thread Gregory P. Smith
Changes by Gregory P. Smith g...@krypto.org: -- versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___ ___

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

2014-06-03 Thread Gregory P. Smith
Changes by Gregory P. Smith g...@krypto.org: -- stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___ ___ Python-bugs-list

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

2014-05-29 Thread Syou Ei
Syou Ei added the comment: http://bugs.python.org/issue21602 The smtplib.py also has the same problem. The EINTR cannot be handled properly. -- nosy: +meishao ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611

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

2014-05-29 Thread Syou Ei
Syou Ei added the comment: @neologix, May I attach the patch file of smtplib.py for review? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-29 Thread Florent Xicluna
Florent Xicluna added the comment: @meishao Previous comments answer your question : http://bugs.python.org/issue20611#msg218836 http://bugs.python.org/issue20611#msg218841 -- ___ Python tracker rep...@bugs.python.org

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

2014-05-29 Thread Syou Ei
Syou Ei added the comment: @flox Thank you for your comment. So we just only modify the socket.py to handle the system level call, is it right? Please let me attach the patch file of socket.py for 2.7.2. -- Added file: http://bugs.python.org/file35400/socket_2_7_2_patch.py

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

2014-05-29 Thread tholzer
tholzer added the comment: Oops, I missed a break statement at the end of socket_2.7.3_eintr_patch.py. I've fixed this now in the attached patch. @meishao Could you please also update your socket_2_7_2_patch.py and add the missing break statement ? -- Added file:

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

2014-05-29 Thread tholzer
Changes by tholzer thol...@wetafx.co.nz: Removed file: http://bugs.python.org/file35359/socket_2.7.3_eintr_patch.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-29 Thread Syou Ei
Changes by Syou Ei oss.sh...@gmail.com: Removed file: http://bugs.python.org/file35400/socket_2_7_2_patch.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-29 Thread Syou Ei
Syou Ei added the comment: @tholzer I've updated socket_2_7_2_patch.py and added the missing break statement. -- Added file: http://bugs.python.org/file35408/socket_2_7_2_patch.py ___ Python tracker rep...@bugs.python.org

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

2014-05-29 Thread tholzer
tholzer added the comment: And a test case for smtplib: import threading import signal import os import smtplib def go(): running = True pid = os.getpid() def killer(): while running: os.kill(pid, signal.SIGINT) signal.signal(signal.SIGINT, lambda x,y:

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

2014-05-25 Thread tholzer
tholzer added the comment: No problem, I've attached a patch for socket.py for Python 2.7.3. A few notes: getaddrinfo (and gethostbyname, etc.) are already immune to this bug, so I've just fixed the connect() call. The socket does need to be closed after EINTR, otherwise a EINPROGRESS might

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

2014-05-25 Thread tholzer
tholzer added the comment: I've also attached a potential patch for the C module Modules/socketmodule.c inside internal_connect(). A few notes: This seems to work both without time-out and with time-out sockets (non-blocking). One concern would be a signal storm prolonging the operation

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

2014-05-25 Thread tholzer
Changes by tholzer thol...@wetafx.co.nz: Added file: http://bugs.python.org/file35361/socketmodule_2.7.6_eintr_patch.c ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-25 Thread tholzer
Changes by tholzer thol...@wetafx.co.nz: Removed file: http://bugs.python.org/file35360/socketmodule_2.7.6_eintr_patch.c ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: @tholzer, to clarify Charles-François's comment: EINTR should be handled in socket.connect() and socket.getaddrinfo() (the two syscalls called by create_connection(), AFAIR). -- ___ Python tracker

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

2014-05-19 Thread tholzer
tholzer added the comment: We encountered the same problem, this is in the context of using PyQt (specifically QProcess) or twisted. They both rely on SIGCHLD for their notification framework. I've attached a httplib EINTR patch for 2.6.4 2.7.3. -- nosy: +tholzer Added file:

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

2014-05-19 Thread tholzer
Changes by tholzer thol...@wetafx.co.nz: Added file: http://bugs.python.org/file35297/httplib_2.7.3_eintr_patch.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-05-19 Thread tholzer
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)

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

2014-05-19 Thread Charles-François Natali
Charles-François Natali added the comment: As said in a previous comment, we don't want to have EINTR handling code everywhere. The right way to do this is to handle it at the syscall level. -- ___ Python tracker rep...@bugs.python.org

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

2014-02-12 Thread Florent Xicluna
New submission from Florent Xicluna: I had this sporadic traceback in a project: File test.py, line 62, in module result = do_lqs(client, str(dnvn)) File test.py, line 25, in do_lqs qualif_service_id = client.create('ti.qualif.service', {}) File

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

2014-02-12 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo, neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___ ___

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

2014-02-12 Thread Florent Xicluna
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +gregory.p.smith, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20611 ___

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

2014-02-12 Thread Charles-François Natali
Charles-François Natali added the comment: It seems that the EINTR should be caught by the standard library in all cases: http://bugs.python.org/issue1628205 Yes, it should. But it's not the case for the socket.create_connection method (verified in 3.3 and 2.7 source code). It's not the