Skip to content

glibc: fix race condition when building stubs#13342

Merged
andrewrk merged 2 commits intomasterfrom
fix-glibc-race
Oct 29, 2022
Merged

glibc: fix race condition when building stubs#13342
andrewrk merged 2 commits intomasterfrom
fix-glibc-race

Conversation

@andrewrk
Copy link
Copy Markdown
Member

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

@motiejus I would be grateful if you would try your test script on your 96 core machine for a bit. I will do the same on my machine overnight.

@motiejus
Copy link
Copy Markdown
Contributor

Thanks for the PR!

@motiejus I would be grateful if you would try your test script on your 96 core machine for a bit. I will do the same on my machine overnight.

Starting the run now. I will be offline for a while, will report after ~16-24 hours.

@motiejus
Copy link
Copy Markdown
Contributor

Looks like I reproduced it again. I will do a clean run and put more details here.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

race condition when building glibc stubs

2 participants