[IPython-dev] race condition when starting more than one IPython for the first time

William Stein wstein at gmail.com
Sun Apr 27 10:50:59 EDT 2014


Hi,

I don't know if you consider this a bug, but I just started IPython
(via the Sage command line) for the first time as a given user thrice
at once (in tmux), and only of the three worked.  The other two failed
in this code:

File "/usr/local/sage/sage-6.2.rc0/local/lib/python2.7/site-packages/IPython/core/application.py",
line 222, in _ipython_dir_changed
    os.makedirs(new, mode=0o777)

This is a classical race-condition mistake -- checking if a directory
exists, then creating the directory if it doesn't, except by the time
you create it, it already exists.  It would be best to wrap the
creation in a try/except and if there is an error, check if the
directory already exists.   I've also attached a screenshot.

I'm in no hurry for this to be fixed, but if you guys fix it, then
it'll be fixed for Sage as well eventually, which would be nice.

 -- William

-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2014-04-27 at 7.39.25 AM.png
Type: image/png
Size: 315641 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140427/5dc81649/attachment.png>


More information about the IPython-dev mailing list