[rubygems/rubygems] Fix race condition on bundler's parallel installer
When installing in parallel, bundler creates several Gem::Installer instances that run in parallel. These installers access the @@all class variable of Gem::Specification concurrently.
If a concurrent thread calls Gem::Specification.reset (resetting @all to nil) while another thread is running Gem::Specification._all or another method that expects @@all to be loaded and not nil, that can result in Enumerable methods being called on nil, resulting in crashes.
I fix it by protecting the other concurrent access to the @all variable.
[rubygems/rubygems] Fix race condition on bundler's parallel installer
When installing in parallel, bundler creates several
Gem::Installerinstances that run in parallel. These installers access the
@@allclassvariable of
Gem::Specificationconcurrently.If a concurrent thread calls
Gem::Specification.reset(resetting@alltonil) while another thread is runningGem::Specification._allor another method that expects@@allto beloaded and not
nil, that can result inEnumerablemethods beingcalled on
nil, resulting in crashes.I fix it by protecting the other concurrent access to the
@allvariable.
https://github.com/rubygems/rubygems/commit/58b343c530