Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlock issue from threads autoloading and requiring the same dependency #688

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/spring/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def gemfile
if /\s1.9.[0-9]/ === Bundler.ruby_scope.gsub(/[\/\s]+/,'')
Pathname.new(ENV["BUNDLE_GEMFILE"] || "Gemfile").expand_path
else
# default_gemfile autoloads SharedHelpers, but this causes deadlocks because it occurs in a separate thread.
# application/boot.rb loads the application in the main thread which calls bundler/setup and requires
# shared_helpers instead of autoloading. Due to a ruby bug, autoloading and requiring the same file in separate
# threads can cause deadlocks. Requiring shared_helpers here prevents it from being autoloaded.
require "bundler/shared_helpers"
Bundler.default_gemfile
end
end
Expand Down