-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Fix race condition when importing typelibs on Windows #3711
base: master
Are you sure you want to change the base?
Conversation
On Windows, if a file #import's a type library, the compiler automatically generates .tlh and .tli files in the build directory. The compiler does not synchronize writes of these files so they should be considered side effects. They unfortunately have timestamps and absolute paths in them so (1) they are not cacheable and (2) cannot be considered as sources or they will cause unnecessary cache misses. However, setting them as normal SCons side effects would cause all files with the same target directory with that dependency to no longer be executed in parallel. My solution is to introduce the idea of a temporary side effect. This effectively prevents all nodes with that side effect from executing at the same time until one node has successfully run. Once one node has successfully run, then it is no longer considered to be a side effect because it is already generated.
Not sure if this should go in SCons.Platform instead.
…ependency The temporary side effect's "sources" entry wasn't being cleared after it was processed. This was a problem when postprocessing the temporary side effect for the second binary afterwards because the code tried to remove the temporary side effect from sources of the first binary, when it had already been handled. A test is included that consistently failed without the fix.
If a file was scanned after the temporary side effect expired, the temporary side effect was being added again despite it not being necessary. Fix that by not setting temporary side effects if they are already up-to-date.
An empty directory side-effect is up-to-date so it's not a good fit for a test related to temporary side effects. Change it to a file.
I didn't change doc/user/sideeffect.xml but I can if you all would like me to. Just let me know. |
How does this stuff relate to |
Yeah, that's right; |
On Windows, if a file
#import
's a type library, the compiler automatically generates.tlh
and.tli
files in the build directory. The compiler does not synchronize writes of these files so they should be considered side effects. They unfortunately have timestamps and absolute paths in them so (1) they are not cacheable and (2) cannot be considered as sources or they will cause unnecessary cache misses. However, setting them as normal SCons side effects would cause all files with the same target directory with that dependency to no longer be executed in parallel.My solution is to introduce the idea of a temporary side effect. This effectively prevents all nodes with that side effect from executing at the same time until one node has successfully run. Once one node has successfully run, then it is no longer considered to be a side effect because it is already generated.
Fixes #2161
Contributor Checklist:
CHANGES.txt
(and read theREADME.rst
)