spring
spring copied to clipboard
Processes just hang with Spring 4.0
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
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.
Same but on Rails 5.2
same is happening with me for rails c, it gets hang and nothing happens. very problemetic
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
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?
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.
We haven't been on Bundler 1.x for awhile, so seems this can be surfaced multiple ways 🤔
@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.
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
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