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

Paul Ivanov pi at berkeley.edu
Tue Apr 29 12:19:47 EDT 2014


William Stein, on 2014-04-27 07:50,  wrote:
> 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.

Thanks for reporting, William, I've started working on a PR to
fix all instances of such race conditions in our codebase:

https://github.com/ipython/ipython/pull/5750

-- 
                   _
                  / \
                A*   \^   -
             ,./   _.`\\ / \
            / ,--.S    \/   \
           /  `"~,_     \    \
     __o           ?
   _ \<,_         /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
http://pirsquared.org



More information about the IPython-dev mailing list