Repository navigation
fix: close remaining concurrent solc install races - #255
Merged
Merged
Conversation
A child forked by another thread while the installer's temp file is open for writing keeps a duplicate of the write handle until it execs. Closing the installer's own handle is not enough: Linux refuses to execute a file that is open for writing anywhere, so `install` could return a binary that fails with ETXTBSY, and only consumers that retry the launch recovered. Before publishing, launch the prepared binary with bounded retries while it is busy and kill the probe once it starts. A writer that outlives the retries fails the install, so the existing retry loop prepares a new file instead of publishing an unusable one.
Windows releases up to 0.7.1 are zip artifacts whose checksum never matches the installed solc.exe, so every install re-extracted the archive over a binary and DLLs that could be in use, which Windows refuses. Compare an existing installation with the binary inside the downloaded archive instead.
DaniPopes
reviewed
Sep 27, 2026
DaniPopes
approved these changes
Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #230, which closed the ETXTBSY races behind foundry-rs/foundry#4736 but left two gaps that its description called out.
A child forked by another thread while the installer's temporary file is open for writing keeps a duplicate of the write handle until it execs. Closing the installer's own handle is not enough, because Linux refuses to execute a file that is open for writing anywhere, so
installcould still return a binary that fails withText file busy. The svmsolcwrapper and foundry-compilers retry such launches, but other consumers do not. The installer now probes the prepared binary by launching it before the rename, retrying with bounded backoff while the kernel reports it busy, and kills the probe as soon as it starts. If a writer outlives the retries, for example a forked child that never execs, the install fails instead of publishing an unusable binary, and the existing retry loop prepares a new file. The probe only runs on Linux and Android, since macOS executes files that are open for writing.The new
publication_with_forking_threadregression installs while another thread keeps forking children that are slow to exec. On master it failed 30 of 30 stress runs, with one run returning a binary that could not be launched for 31 of 100 installs; with this change it passes 30 of 30.Windows releases up to 0.7.1 are zip artifacts, so the installed
solc.exenever matched the artifact checksum and every install re-extracted the archive over a binary and DLLs that other processes could be running, which Windows refuses. An existing installation is now compared with thesolc.exeinside the downloaded archive and reused when it matches. The newcan_reinstall_windows_zip_release_while_runningtest covers this in the Windows CI job; it has not been run on Windows locally.