You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eintr-1.diff doesn't seem to make any significant difference from eintr.diff on my system. It's still pegging a CPU at 100% and takes 7 minutes wall time to complete.
Alright, enough played: the patch attached uses a memoryview and
socket.recv_into() to remove all memory allocations: if this doesn't
fix your problem, I don't know what's going on...
$ time ./python ~/Projects/PyDev/active/dev/3x/source/Lib/test/eintrdata/eintr_tester.py
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
Ran 12 tests in 7.652s
OK
real 0m7.959s
user 0m2.573s
sys 0m1.604s
Instrumented test_send, 3 socket.send calls, many socket.recv_into calls:
test_send (main.SocketEINTRTest) ... rd SO_RCVBUF default was 8192, wr SO_SNDBUF default was 8192
len(data) = 16777215
sent = 8192, total written = 8192
sent = 4440064, total written = 4448256
sent = 1232895, total written = 16777215
received = 8192, total read = 8192
received = 8192, total read = 16384
received = 8192, total read = 24576
[...]
received = 8192, total read = 16760832
received = 8192, total read = 16769024
received = 8191, total read = 16777215
neologix commented on Jan 29, 2015
neologixmannequin
MannequinAuthor
More actions
With eintr-2.diff, fast!:
Victory \°/.
Instrumented test_send, 3 socket.send calls, many socket.recv_into calls:
Yep, that's expected.
I think we should keep the default socket buffer size: it increases
the test coverage, and it's probably not worth trying to increase it
to make the test a bit faster, especially since it spends so much time
sleeping.
Antoine, I'm now happy with the patch, so we'll be waiting for your
decision on the PEP with Victor :-).
I didn't read these articles yet, but I will. IMO the PEP must be
updated if we don't retry in close(), since close() is used as an
example where "EINTR is unexpected"!
Would it be possible to push the latest patch right now, and fix remaining issues (if there are known issues?), before Python 3.4 alpha 1? According to the PEP-478, the alpha 1 is scheduled for this sunday (February 8, 2015).
The change on Modules/_io/fileio.c is wrong: functions may return None with an exception set. It is wrong because a function must return a result with no exception set, or NULL and an exception set.
The test calls print() in a signal handler which can likely create a reentrant call, which is forbidden. But Python handles this case, it's fine.
After removing all debug prints and reverting the fix on fileio.c, the test doesn't crash with the assertion error anymore. Before, an assertion failed because fileio_write() returned Py_None with an exception set.
neologix commented on Mar 3, 2015
neologixmannequin
MannequinAuthor
More actions
@victor: please commit.
Would be nice to have a test for it;
For the record, it seems test_eintr sometimes left zombie processes in my machine where I run reference leak tests every night. I didn't investigate and just disabled the tests.
For the record, it seems test_eintr sometimes left zombie processes in my machine where I run reference leak tests every night. I didn't investigate and just disabled the tests.
(I'll add that that machine is hosted on an OpenVZ-based VPS, so perhaps there are issues with the old patched kernel and whatnot?)
On my Fedora 21 (on a physical PC, not virtualized), I ran "./python -m test -R 3:3: test_eintr" 3 times. After that, I didn't see any zombi Python process. If I cannot reproduce the issue, I cannot fix it. I bet that it's related to OpenVZ.
IMO this issue can be closed. It already has a long history. I prefer to open new issues. See the issue bpo-23648 "PEP-475 meta issue" which lists all issues related to the PEP-475. I opened new issues for each module which didn't handle completly the PEP-475 yet.
By the way: great job Charles-François! I like your changeset, it works well.
Activity
neologix commentedon Jan 29, 2015
Alright, enough played: the patch attached uses a memoryview and
socket.recv_into() to remove all memory allocations: if this doesn't
fix your problem, I don't know what's going on...
ned-deily commentedon Jan 29, 2015
With eintr-2.diff, fast!:
Ran 12 tests in 7.652s
OK
real 0m7.959s
user 0m2.573s
sys 0m1.604s
Instrumented test_send, 3 socket.send calls, many socket.recv_into calls:
test_send (main.SocketEINTRTest) ... rd SO_RCVBUF default was 8192, wr SO_SNDBUF default was 8192
len(data) = 16777215
sent = 8192, total written = 8192
sent = 4440064, total written = 4448256
sent = 1232895, total written = 16777215
received = 8192, total read = 8192
received = 8192, total read = 16384
received = 8192, total read = 24576
[...]
received = 8192, total read = 16760832
received = 8192, total read = 16769024
received = 8191, total read = 16777215
neologix commentedon Jan 29, 2015
Victory \°/.
Yep, that's expected.
I think we should keep the default socket buffer size: it increases
the test coverage, and it's probably not worth trying to increase it
to make the test a bit faster, especially since it spends so much time
sleeping.
Antoine, I'm now happy with the patch, so we'll be waiting for your
decision on the PEP with Victor :-).
pitrou commentedon Jan 30, 2015
Victor, do you think there's anything left to do?
neologix commentedon Jan 31, 2015
I just realized I didn't retry upon EINTR for open(): eintr-4.diff
adds this, along with tests (using a fifo).
Also, I added comments explaining why we don't retry upon close() (see
e.g. http://lwn.net/Articles/576478/ and
http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-09/3000.html).
vstinner commentedon Jan 31, 2015
Charles-François Natali added the comment:
I didn't read these articles yet, but I will. IMO the PEP must be
updated if we don't retry in close(), since close() is used as an
example where "EINTR is unexpected"!
pitrou commentedon Feb 2, 2015
PEP is now updated.
vstinner commentedon Feb 5, 2015
Would it be possible to push the latest patch right now, and fix remaining issues (if there are known issues?), before Python 3.4 alpha 1? According to the PEP-478, the alpha 1 is scheduled for this sunday (February 8, 2015).
pitrou commentedon Feb 5, 2015
It's ok for me. Please watch the buildbots :)
neologix commentedon Feb 5, 2015
Cool, I'll push on Friday evening or Saturday.
python-dev commentedon Feb 7, 2015
New changeset 5b63010be19e by Charles-François Natali in branch 'default':
Issue bpo-23285: PEP-475 -- Retry system calls failing with EINTR.
https://hg.python.org/cpython/rev/5b63010be19e
python-dev commentedon Feb 8, 2015
New changeset 000bbdf0ea76 by Ned Deily in branch 'default':
Issue bpo-23285: Install new test directory.
https://hg.python.org/cpython/rev/000bbdf0ea76
vstinner commentedon Mar 3, 2015
The change on Modules/_io/fileio.c is wrong: functions may return None with an exception set. It is wrong because a function must return a result with no exception set, or NULL and an exception set.
Attached patch fixes this issue.
vstinner commentedon Mar 3, 2015
Note: I found the bug while working on a patch for bpo-22181.
My test is this shell script:
The test calls print() in a signal handler which can likely create a reentrant call, which is forbidden. But Python handles this case, it's fine.
After removing all debug prints and reverting the fix on fileio.c, the test doesn't crash with the assertion error anymore. Before, an assertion failed because fileio_write() returned Py_None with an exception set.
neologix commentedon Mar 3, 2015
@victor: please commit.
Would be nice to have a test for it;
vstinner commentedon Mar 4, 2015
There are already some tests on EINTR in test_file_eintr and test_subprocess (test_communicate_eintr()).
python-dev commentedon Mar 4, 2015
New changeset cad6eac598ec by Victor Stinner in branch 'default':
Issue bpo-23285: Fix handling of EINTR in fileio.c
https://hg.python.org/cpython/rev/cad6eac598ec
vstinner commentedon Mar 9, 2015
test_setitimer.patch: hack unittest.TestCase.run() to inject signals every 1 ms, send the first signal in 100 ms.
This patch helped me to find that socket.connect() doesn't handle EINTR yet: see issue bpo-23618 "PEP-475: handle EINTR in the socket module".
pitrou commentedon Mar 9, 2015
For the record, it seems test_eintr sometimes left zombie processes in my machine where I run reference leak tests every night. I didn't investigate and just disabled the tests.
pitrou commentedon Mar 9, 2015
(I'll add that that machine is hosted on an OpenVZ-based VPS, so perhaps there are issues with the old patched kernel and whatnot?)
vstinner commentedon Mar 20, 2015
On my Fedora 21 (on a physical PC, not virtualized), I ran "./python -m test -R 3:3: test_eintr" 3 times. After that, I didn't see any zombi Python process. If I cannot reproduce the issue, I cannot fix it. I bet that it's related to OpenVZ.
IMO this issue can be closed. It already has a long history. I prefer to open new issues. See the issue bpo-23648 "PEP-475 meta issue" which lists all issues related to the PEP-475. I opened new issues for each module which didn't handle completly the PEP-475 yet.
By the way: great job Charles-François! I like your changeset, it works well.