-
Notifications
You must be signed in to change notification settings - Fork 83
Replace custom atomicWrite by more robust library call. #334
Replace custom atomicWrite by more robust library call. #334
Conversation
The The patch seems plausible to me, merging this. Thanks! |
Hi, just checked this patch with this simple test:
Without this fix:
With this fix:
|
@izmmisha Thanks for the test. I did some test runs with it. Both implementations with 200.000 calls to
Did you also see such kind of frequency of fails? I think the race condition that |
It need more investigation, the problem exists only in user home directory (except temp directory), the simplest solution right now is move clcache folder out of user home directory. |
@izmmisha Looking at this post nodejs/node-gyp#1124 maybe the default |
It is not unusual that we observed the atomic_write() has data race in multipul threads and can raise exception to stop build as below: PermissionError: [WinError 5] Access is denied. Even the %LOCALAPPDATA% suggestion in below links still cannot totally fix the exceptions in our CI build system frerich#334 (comment) frerich#342 So, simply retry the atomic_write() several times first and then just pass through if still fails. The save() work around looks only impact the statistics data accurate. Since The build expection hang is always show stopper issue for us with top priority, it's OK for us get harden stable compiler cache with cost of inaccurate statistics info.
When can this be released? |
Issue
We are sometimes seeing following exception when we run our build with many cores:
Searching a bit makes it look like there is a race condition:
Looking with that in mind at the
atomicWrite
function:Solution
Replacing the
atomicWrite
function withatomic_write
from the atomicwrites package seems to solve the issue (https://pypi.org/project/atomicwrites/). The package takes care of such race conditions so we no longer have to think about it.