Skip to content

Serialize concurrent installs of the same gem - #10107

Merged
hsbt merged 1 commit into
masterfrom
lock-gem-install
Nov 20, 2026
Merged

hsbt merged 1 commit into
masterfrom
lock-gem-install

Conversation

@hsbt

@hsbt hsbt commented Nov 20, 2026

Copy link
Copy Markdown
Member

Two gem install processes installing the same gem into one GEM_HOME can fail when one removes the directory where the other is compiling a native extension.

Take a per-gem lock before replacing the existing files and release it after the new files are in place. Installs into different gem directories can still run concurrently. Plugin loading happens after the lock is released, so an overlapping reinstall can still affect plugin discovery.

Fixes #7786.

A second install can remove files that the first is still compiling. Keep the lock outside the gem directory so replacing the directory cannot release it.
@hsbt
hsbt merged commit 5563796 into master Nov 20, 2026
114 checks passed
@hsbt
hsbt deleted the lock-gem-install branch November 20, 2026 03:23
@hsbt hsbt added the skip old stable Leave out of releases on the old stable line label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rubygems: bug fix skip old stable Leave out of releases on the old stable line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installing native extensions at the same time

1 participant