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

William Stein wstein at gmail.com
Tue Apr 29 12:25:19 EDT 2014


On Tue, Apr 29, 2014 at 9:19 AM, Paul Ivanov <pi at berkeley.edu> wrote:
> 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

Awesome, thanks!

>
> --
>                    _
>                   / \
>                 A*   \^   -
>              ,./   _.`\\ / \
>             / ,--.S    \/   \
>            /  `"~,_     \    \
>      __o           ?
>    _ \<,_         /:\
> --(_)/-(_)----.../ | \
> --------------.......J
> Paul Ivanov
> http://pirsquared.org
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org



More information about the IPython-dev mailing list