-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
adding the same C source file redundantly to the same compilation results in a deadlock #7308
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
Comments
Cache now stores files as an StringArrayListHashMap instead of an ArrayList. The key is the resolved file path, to avoid adding the same file multiple times into the cache system when it is depended on multiple times. This avoids re-hashing file contents that have already been inserted into the cache. This was an attempt to fix #7308, but it is solving a different problem. I do think it is worth considering this improvement regardless. On the other hand, it might be duplicated effort since the layer of code above this one probably wants to do its own de-duplication as well. This implementation would be much nicer with #7391.
One observation here is that if there were different flags for the different object files, then they would get different cache manifests and thus would not deadlock. The deadlock will only happen when the resulting object files will be identical, and therefore would cause symbol collisions. So I think we can detect this situation and report a friendly error message "foo.c is provided multiple times with the same flags". |
Cache exposes BinDigest. Compilation gains a set of a BinDigest for every C/C++ source file. We detect when the same source/flags have already been added and emit a compile error. This prevents a deadlock in the caching system. Closes #7308
Cache exposes BinDigest. Compilation gains a set of a BinDigest for every C/C++ source file. We detect when the same source/flags have already been added and emit a compile error. This prevents a deadlock in the caching system. Closes #7308
Cache exposes BinDigest. Compilation gains a set of a BinDigest for every C/C++ source file. We detect when the same source/flags have already been added and emit a compile error. This prevents a deadlock in the caching system. Closes #7308
Cache exposes BinDigest. Compilation gains a set of a BinDigest for every C/C++ source file. We detect when the same source/flags have already been added and emit a compile error. This prevents a deadlock in the caching system. Closes ziglang#7308
To reproduce:
Expected behavior: Even though it would typically cause symbol collisions, it should be allowed, because it is possible to supply each source file with a different set of preprocessor definitions, which would cause the source files to have different sets of symbols.
Actual behavior: Deadlock in the cache system
The text was updated successfully, but these errors were encountered: