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

Processes just hang with Spring 4.0 #663

Open
coding-bunny opened this issue Dec 13, 2021 · 10 comments
Open

Processes just hang with Spring 4.0 #663

coding-bunny opened this issue Dec 13, 2021 · 10 comments

Comments

@coding-bunny
Copy link

Hello,

With the release of Spring 4.0, rake tasks and processes just hang, both on local systems as well as the CI Pipeline.
For example:

bundle exec rails db:drop db:create db:schema:load

The above will just run indefinitely, with no output or any error messages.
Does not respond to CTRL+C interrupts and requires the usage of kill to actually terminate the Ruby processes.

However when I switch back to Spring 3.1.1 everything worked:

olivar@Arnes-MacBook-Pro  ~/RubymineProjects/deployment_history   master  bundle exec rake db:drop
Dropped database 'deployment_history_development'
olivar@Arnes-MacBook-Pro  ~/RubymineProjects/deployment_history   master  bundle exec rake db:create db:schema:load
Created database 'deployment_history_development'

This is on a Rails 6.1 Project with Ruby 2.7.3

@juhguu
Copy link

juhguu commented Dec 14, 2021

I have the same issue with Spring 4.0 or 3.1.1.
I'm using ubuntu 20.04, Rails 6.1.4.1 and ruby 3.0.1 with rbenv.
The only command that works for me is rails server.
When I remove the Spring of my project everything works.

@kwstannard
Copy link

Same but on Rails 5.2

@siddhant-mohan
Copy link

same is happening with me for rails c, it gets hang and nothing happens. very problemetic

@gabrielboeker
Copy link

has been anything done since then? i was just tinkering around for 45 minutes to get my app running again since the rails commands were not executed anymore. downgraded spring to 2.1.1 to make it work again. im on Rails 6.1.4. and Ruby 2.7.4. Spring was on 4.0.0 which was broken

@technicalpickles
Copy link
Contributor

I've seen similar issues before. spring stop can help, but it often occurs again. Just now when I ran into it, I poked around with ps -ef | grep spring, and had several spring processes from the past few days. I've killed those, and it seems to be looking better.

Anyone have ideas on what type of data to collect the next time I see it?

@timdiggins
Copy link
Contributor

I've had this problem and for me the problem was I was using Bundler v1 which doesn't provide Bundler.with_unbundled_env which Spring 4 uses. Upgrading to Bundler v2 for this project has solved this (https://bundler.io/guides/bundler_2_upgrade.html)

FYI to debug this and find the problem I did the following:

  • Start spring as a foreground process (so you can see the issue) in one terminal session using spring server.
  • Then start a rails process (like rails c) in another terminal session.
  • The "spring server" quits with a traceback, showing the problem.

timdiggins added a commit to timdiggins/spring that referenced this issue Sep 15, 2022
Spring 4.0.0 uses with_unbundled_env which is only
available with Bundler 2.1 (see
https://bundler.io/v2.1/whats_new.html#helper-deprecations)

This has caused issues with some people using e.g Bundler v1
rails#663
@technicalpickles
Copy link
Contributor

We haven't been on Bundler 1.x for awhile, so seems this can be surfaced multiple ways 🤔

@timdiggins
Copy link
Contributor

@technicalpickles Have you tried using spring server to run spring in the foreground (having quit all the other springs) -- this could give you a stack trace that might help pinpoint the source of the problem.

@fschwahn
Copy link

fschwahn commented Oct 7, 2022

We've recently updated to spring 4.1.0 (from spring 3.1.1), and I've seen multiple occasions of spring locking up. I haven't seen this with older versions. I have a backtrace to share:

16:08:24 spring.1    | /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:23:in `unlock': Attempt to unlock a mutex which is locked by another thread/fiber (ThreadError)
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:23:in `ensure in synchronize'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:23:in `synchronize'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:40:in `with_child'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:61:in `run'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:65:in `serve'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `block in start_server'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `loop'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `start_server'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:43:in `boot'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:14:in `boot'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client/server.rb:10:in `call'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client/command.rb:7:in `call'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client.rb:30:in `run'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/bin/spring:49:in `<top (required)>'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/binstub.rb:5:in `load'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/binstub.rb:5:in `<top (required)>'
16:08:24 spring.1    |  from <internal:/Ruby/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
16:08:24 spring.1    |  from <internal:/Ruby/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
16:08:24 spring.1    |  from bin/spring:10:in `block in <main>'
16:08:24 spring.1    |  from <internal:kernel>:90:in `tap'
16:08:24 spring.1    |  from bin/spring:7:in `<main>'
16:08:24 spring.1    | /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:20:in `lock': Interrupt
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:20:in `synchronize'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:40:in `with_child'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/application_manager.rb:61:in `run'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:65:in `serve'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `block in start_server'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `loop'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:49:in `start_server'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:43:in `boot'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/server.rb:14:in `boot'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client/server.rb:10:in `call'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client/command.rb:7:in `call'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/client.rb:30:in `run'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/bin/spring:49:in `<top (required)>'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/binstub.rb:5:in `load'
16:08:24 spring.1    |  from /Ruby/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.1.0/lib/spring/binstub.rb:5:in `<top (required)>'
16:08:24 spring.1    |  from <internal:/Ruby/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
16:08:24 spring.1    |  from <internal:/Ruby/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
16:08:24 spring.1    |  from bin/spring:10:in `block in <main>'
16:08:24 spring.1    |  from <internal:kernel>:90:in `tap'
16:08:24 spring.1    |  from bin/spring:7:in `<main>'
16:08:24 spring.1    | terminated by SIGTERM

@rylanb
Copy link

rylanb commented Nov 4, 2022

If I run bin/rails c and do somethings (or do nothing) and then type exit on Rails 6.1.7. It just sits and hangs.

If I take out spring, no issues. Curious what is going on there! spring (4.1.0) in the Gemfile.lock

smartech7 pushed a commit to smartech7/ruby-preloader-spring that referenced this issue Aug 4, 2023
Spring 4.0.0 uses with_unbundled_env which is only
available with Bundler 2.1 (see
https://bundler.io/v2.1/whats_new.html#helper-deprecations)

This has caused issues with some people using e.g Bundler v1
rails/spring#663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants