-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
race condition when building glibc stubs #13160
Comments
Potential cause: #9836 |
Looking at I am now testing this patch:
Am I missing something? |
Yes - at this point where you have inserted lines, if you look up a few lines there is this: Line 679 in c66d3f6
If it is a cache hit ( Before we go down that road, however, I noticed a more important problem: there is this "actual hit" logic: Lines 683 to 699 in c66d3f6
Problem is that if |
Before, the code for building glibc stubs used a special case of the Cache API that did not add any file inputs, and did not use writeManifest(). This is not really how the Cache API is designed to work and it shows because there was a race condition. This commit adds as an input file the abilists file that comes with Zig's installation, which has the added benefit of making glibc stub caching properly detect cache invalidation when the user decides to overwrite their abilists file. This harmonizes with the rest of how Zig works, which intentionally allows you to hack the installation files and have it behave properly with the cache system. Finally, because of having any file inputs, the normal API flow of the Cache system can be used, eliminating the one place that used the Cache API in a special way. In other words, it uses writeManifest() now and properly obeys the cache hit/miss semantics. closes #13160
Before, the code for building glibc stubs used a special case of the Cache API that did not add any file inputs, and did not use writeManifest(). This is not really how the Cache API is designed to work and it shows because there was a race condition. This commit adds as an input file the abilists file that comes with Zig's installation, which has the added benefit of making glibc stub caching properly detect cache invalidation when the user decides to overwrite their abilists file. This harmonizes with the rest of how Zig works, which intentionally allows you to hack the installation files and have it behave properly with the cache system. Finally, because of having any file inputs, the normal API flow of the Cache system can be used, eliminating the one place that used the Cache API in a special way. In other words, it uses writeManifest() now and properly obeys the cache hit/miss semantics. closes #13160
Re-opening since @motiejus reported reproducing the problem in #13342 (comment) |
I can no longer reproduce it. I suspect I tested I will leave this running for the rest of the weekend (next 24h or so) and then close the task if it does not pop up again. |
It's been running two 96-core servers for >24 hours now without failure. Good job! |
Summary: multiple
zig
invocations can stumble upon each other when they are creating glibc stubs.Steps to reproduce
main.c
Command: run
zig c++
many times in parallel:And get an error message similar to this (more examples of error messages later in the issue):
It takes me between 5 and 60 minutes to reproduce on a 96-core machine. It took a few hours on an 8-core laptop.
If we trim everything after that last
fabs
(i.e. where the error message says), the file is 65536 bytes long, suggesting an unfinished write by another zig.Cursory look at
glibc.zig
shows no collaboration between multiple zig invocations that want to build the same stubs. That's perhaps the issue, but I didn't (yet) have a chance to dig into this deeper.The text was updated successfully, but these errors were encountered: