spring icon indicating copy to clipboard operation
spring copied to clipboard

Processes just hang with Spring 4.0

Open coding-bunny opened this issue 3 years ago • 10 comments

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

coding-bunny avatar Dec 13 '21 09:12 coding-bunny

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.

juhguu avatar Dec 14 '21 03:12 juhguu

Same but on Rails 5.2

kwstannard avatar Dec 16 '21 05:12 kwstannard

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

siddhant-mohan avatar Feb 10 '22 10:02 siddhant-mohan

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

gabrielboeker avatar Jun 24 '22 12:06 gabrielboeker

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?

technicalpickles avatar Aug 31 '22 14:08 technicalpickles

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 avatar Sep 15 '22 11:09 timdiggins

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

technicalpickles avatar Sep 15 '22 13:09 technicalpickles

@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.

timdiggins avatar Sep 15 '22 17:09 timdiggins

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

fschwahn avatar Oct 07 '22 14:10 fschwahn

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

rylanb avatar Nov 04 '22 20:11 rylanb