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
{{ message }}
Repository navigation
sys.stdout.write on Python 2.7 is not EINTR safe #66206
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2014-07-22.20:16:05.517>created_at=<Date2014-07-18.21:10:00.912>labels= ['expert-IO']
title='sys.stdout.write on Python 2.7 is not EINTR safe'updated_at=<Date2014-07-30.17:07:37.502>user='https://bugs.python.org/jstewmon'
Writing to sys.stdout on OS X can fail with IOError: [Errno 4] Interrupted system call.
I have observed this while trying to write to sys.stdout when SIGCHLD is received. The script below consistently reproduces the problem with python 2.7.2 on OS X 10.9.3.
There have been a number of EINTR-releated issues reported in the past, some unique to BSD-based systems and/or OS X; see for example, bpo-9867 and bpo-12268. I don't know that any of them specifically addressed problems with writes to Python 2 file objects. FWIW, with your test case, I'm not able to reproduce a failure on 10.9.3 using python.org 2.7.8 or 2.7.3 or with the system 2.7.5. And, with a modified print(), I didn't see a failure with python.org 3.4.1, either. Can you say more about the origins of your Python 2.7.2? Have you tried with a current 2.7.8? How quickly does the test fail, e.g. after how many iterations?
Yes, an issue not likely to be addressed in Python 2.7. I'm still curious as to why I'm not able to reproduce the problem, though. I suppose it could just come down to differences in the system it is running on, like workload, amount of memory, and/or number of processors.
jstewmon commented on Jul 18, 2014
jstewmonmannequin
MannequinAuthor
More actions
Sorry, I had a typo in the original report - I am actually using Python 2.7.7 installed with homebrew.
The script crashes for me on the first iteration every time using iTerm as my terminal. I just tried it in Terminal, and it doesn't crash.
I also can reproduce this on Linux with Python 2.7 but not with 3.4 which uses a different io system. So the question is: is anyone interested in addressing this for Python 2 file objects?
I'm interested to work on all EINTR issues, including Python 2.
I'm working on a new PEP with Charles-François Natali to address *all* EINTR at once in Python 3.5. If the PEP is accepted, we may fix some EINTR issues on Python 2. Some changes change the behaviour and so cannot we done in Python 2. Well, the PEP is still a draft, we will see that later.
Activity
jstewmon commentedon Jul 18, 2014
Writing to sys.stdout on OS X can fail with IOError: [Errno 4] Interrupted system call.
I have observed this while trying to write to sys.stdout when SIGCHLD is received. The script below consistently reproduces the problem with python 2.7.2 on OS X 10.9.3.
ned-deily commentedon Jul 18, 2014
There have been a number of EINTR-releated issues reported in the past, some unique to BSD-based systems and/or OS X; see for example, bpo-9867 and bpo-12268. I don't know that any of them specifically addressed problems with writes to Python 2 file objects. FWIW, with your test case, I'm not able to reproduce a failure on 10.9.3 using python.org 2.7.8 or 2.7.3 or with the system 2.7.5. And, with a modified print(), I didn't see a failure with python.org 3.4.1, either. Can you say more about the origins of your Python 2.7.2? Have you tried with a current 2.7.8? How quickly does the test fail, e.g. after how many iterations?
vstinner commentedon Jul 18, 2014
This issue is just an example of issue addressed by the issue bpo-18885.
ned-deily commentedon Jul 18, 2014
Yes, an issue not likely to be addressed in Python 2.7. I'm still curious as to why I'm not able to reproduce the problem, though. I suppose it could just come down to differences in the system it is running on, like workload, amount of memory, and/or number of processors.
jstewmon commentedon Jul 18, 2014
Sorry, I had a typo in the original report - I am actually using Python 2.7.7 installed with homebrew.
The script crashes for me on the first iteration every time using iTerm as my terminal. I just tried it in Terminal, and it doesn't crash.
Maybe it's actually an issue with iTerm?
vstinner commentedon Jul 18, 2014
I can reproduce the issue on Linux:
vstinner commentedon Jul 19, 2014
Sorry, I forgot to mention that I reproduced the issue on Fedora 20 with Python 2.7.
I cannot reproduce with Python 3.3.
ned-deily commentedon Jul 20, 2014
I also can reproduce this on Linux with Python 2.7 but not with 3.4 which uses a different io system. So the question is: is anyone interested in addressing this for Python 2 file objects?
[-]sys.stdout.write on OS X is not EINTR safe[/-][+]sys.stdout.write on Python 2.7 is not EINTR safe[/+]vstinner commentedon Jul 20, 2014
I'm interested to work on all EINTR issues, including Python 2.
I'm working on a new PEP with Charles-François Natali to address *all* EINTR at once in Python 3.5. If the PEP is accepted, we may fix some EINTR issues on Python 2. Some changes change the behaviour and so cannot we done in Python 2. Well, the PEP is still a draft, we will see that later.
piotrdobrogost commentedon Jul 30, 2014
@hypo
Is there any reason you keep this PEP "secret" :) by not mentioning it on bug 18885?