Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

race condition creating directories in parallel #2

Closed
dominictarr opened this Issue · 1 comment

2 participants

@dominictarr

If many parallel calls are made to makedirp, there is a possible race condition.

say your creating testdir/data/apps and testdir/data/log. the mkdirp call for data/apps sees that data doesn't exists and then the mkdir call for data/log sees the same. Both start to create the directory, but one of the two fails because the other already created the data dir. The failed mkdirp call returns directly and the other just creates all subdirs.

hmm, https://github.com/substack/node-mkdirp/blob/master/index.js#L12 needs to check if there the error is that the directory already exists.

@substack
Owner

Wrote a test. All fixed.

@substack substack closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.