Both operation A and B first checks the existence of tmpDir and thought tmpDir does not exist. Then both of them will try to create it. One of A and B will success and the other will fail.
The root cause is that the asynchronous call sequence isWritable() -> rmFile() may be violated by another call to ncp()
This may be a same bug as #125.
The test case:
The execution result is:
Both operation A and B first checks the existence of
tmpDir
and thoughttmpDir
does not exist. Then both of them will try to create it. One of A and B will success and the other will fail.The root cause is that the asynchronous call sequence
isWritable()
->rmFile()
may be violated by another call toncp()
https://github.com/AvianFlu/ncp/blob/6820b0fbe3f7400fdb283c741ef88b6d8e2d4994/lib/ncp.js#L221-L229
https://github.com/AvianFlu/ncp/blob/6820b0fbe3f7400fdb283c741ef88b6d8e2d4994/lib/ncp.js#L148-L151