summaryrefslogtreecommitdiff
path: root/ext/ripper/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-02-25 18:43:51 +0100
committergit <svn-admin@ruby-lang.org>2021-11-30 20:54:05 +0900
commit7fd88da935c7c6fcafe19cf30642676033ec82bd (patch)
tree4ad6409f708d7f80f368045c187fd8782c9cde75 /ext/ripper/lib
parentd7f6cb0f780a5a48b5d4a937f93d876a90697fc0 (diff)
[rubygems/rubygems] Fix race condition when reading & writing gemspecs concurrentlyHEADmaster
When bundler parallel installer installs gems concurrently, one can get confusing warnings like the following: ``` "[/home/runner/work/rubygems/rubygems/bundler/tmp/2/gems/system/specifications/zeitwerk-2.4.2.gemspec] isn't a Gem::Specification (NilClass instead). ``` I've got these warnings several times in the past, but I never managed to reproduce them, and never look deeply into the root cause, but this time a got a cause that reproduced quite frequently, so I looked into it. The problem is one thread reading a gemspec while another thread is writing it. The write of the gemspec was not protected, so `Gem::Specification.load` could end up seeing a truncated gemspec and thus throw this warning. The fix involve two changes: * Change the methods that write gemspecs to use `Gem.binary_write` which is protected by a lock. * Fix `Gem.binary_write` to create the file lock at file creation time, not when the file already exists after. The realworld user problem caused by this issue happens in bundler, but I'm fixing it in rubygems first, and then I'll backport to bundler whatever needs backporting to fix the issue on the bundler side. https://github.com/rubygems/rubygems/commit/a672e7555c
Diffstat (limited to 'ext/ripper/lib')
0 files changed, 0 insertions, 0 deletions