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

[4.1.0.beta1] Generator calling generate hangs #13381

Closed
jcoyne opened this issue Dec 18, 2013 · 19 comments
Closed

[4.1.0.beta1] Generator calling generate hangs #13381

jcoyne opened this issue Dec 18, 2013 · 19 comments
Assignees
Milestone

Comments

@jcoyne
Copy link
Contributor

jcoyne commented Dec 18, 2013

When I send an INT here's the trace:

    generate  blacklight:assets
^C/Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/run.rb:74:in `gets': Interrupt
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/run.rb:74:in `run_command'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/run.rb:24:in `call'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/command.rb:7:in `call'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/rails.rb:23:in `call'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client/command.rb:7:in `call'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/lib/spring/client.rb:23:in `run'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/spring-1.0.0/bin/spring:31:in `<top (required)>'
    from bin/rails:9:in `load'
    from bin/rails:9:in `<main>'
/Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:252:in `system': Interrupt
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:252:in `run'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:264:in `run_ruby_script'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.1.0.beta1/lib/rails/generators/actions.rb:193:in `block in generate'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:192:in `block in in_root'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:182:in `block in inside'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:125:in `chdir'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:125:in `cd'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:182:in `inside'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/actions.rb:192:in `in_root'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.1.0.beta1/lib/rails/generators/actions.rb:193:in `generate'
    from /Users/justin/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/blacklight-4.5.0/lib/generators/blacklight/blacklight_generator.rb:42:in `copy_public_assets'

Here's the code: https://github.com/projectblacklight/blacklight/blob/v4.5.0/lib/generators/blacklight/blacklight_generator.rb#L42

@jcoyne
Copy link
Contributor Author

jcoyne commented Dec 18, 2013

Works fine in Rails 3.2 and 4.0

@jcoyne
Copy link
Contributor Author

jcoyne commented Dec 18, 2013

/cc @jonleighton can you determine if this is a spring issue?

@we4tech
Copy link

we4tech commented Dec 22, 2013

@jcoyne just experienced the same problem. After forcefully killing all existing spring processes it worked.

@jonleighton
Copy link
Member

@jcoyne can you give me instructions on how to reproduce the problem please?

@jcoyne
Copy link
Contributor Author

jcoyne commented Dec 29, 2013

@jonleighton Here's a generator that causes the hang:

https://github.com/jcoyne/spring_bug/commit/be686db81e5e1e5c90dd5787bdb8d3d2384b1621

clone and then run

$ rails g bug

@ghost ghost assigned jonleighton Jan 1, 2014
jonleighton added a commit to rails/spring that referenced this issue Jan 4, 2014
ApplicationManager#with_child wants to be able to detect an error on the
socket so that we know that the application process is no longer
available. It seems that merely closing the socket here is not enough to
cause the error (I'm not exactly sure why), so use shutdown instead.

This problem was demonstrated by
rails/rails#13381, where we have spring
running a rails generator, which then shells out and calls back into
spring a second time (mind blown). This would be fine except for the
fact that the generator changes the gemfile, which causes the
application process to want to start exiting, only it can't completely
exit because it's still running the generator. That's why we need to
shut down the socket so that the spring server knows to start up another
application process.
@jonleighton
Copy link
Member

Thanks, that's very helpful. The above commit prevents the hanging here, but the devise:install bit will just silently fail, so this fix is still a WIP.

jonleighton added a commit to rails/spring that referenced this issue Jan 10, 2014
A spring command should be able to change the Gemfile and then call back
into spring, with the Gemfile changes reflected.

See rails/rails#13381
@jonleighton
Copy link
Member

I've just release Spring 1.1.0 which fixes this.

@liorsion
Copy link

liorsion commented May 4, 2014

FYI just happened to me. Using spring (1.1.2)

@robin850
Copy link
Member

robin850 commented May 4, 2014

@liorsion : Could you please report to the spring repository with a way to reproduce if this still a problem for you ? Thanks!

@jaake
Copy link

jaake commented Jul 17, 2014

Spring 1.1.3 >
/home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/run.rb:54:in gets': Interrupt from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/run.rb:54:inverify_server_version'
from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/run.rb:25:in call' from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/command.rb:7:incall'
from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in call' from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client/command.rb:7:incall'
from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/client.rb:26:in run' from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/bin/spring:48:in<top (required)>'
from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/binstub.rb:11:in load' from /home/jaake/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/binstub.rb:11:in<top (required)>'
from /home/jaake/Projects/yachamps/bin/spring:16:in require' from /home/jaake/Projects/yachamps/bin/spring:16:in<top (required)>'
from bin/rails:3:in load' from bin/rails:3:in

'

Just hangs there forever...

@vidbina
Copy link

vidbina commented Jul 20, 2014

I just peeked in the rep and noticed that the problem ocurred in the verify_server_version call. I stopped spring (using spring stop) and retried the generate command which subsequently restarted spring. This seemed to resolve the issue for me. Apparently a mismatch between versions. 😉

@conraddecker
Copy link

@vidbina That did the trick for me as well. Thank you!

@allcentury
Copy link

thanks @vidbina - solved it for me as well

@jondlm
Copy link

jondlm commented Aug 23, 2014

@vidbina I had the exact same issue and running spring stop fixed it as well. 👍

@alde
Copy link

alde commented Aug 27, 2014

Great, thanks!

spring stop fixed this for me aswell.

@rustanacexd
Copy link

spring stop fixed for mine as well thanks!

@adjiganoff
Copy link

spring stop did the trick, cheers!

@laerciocrestani
Copy link

spring stop +1

@armahillo
Copy link

spring stop FTW.

@rails rails locked and limited conversation to collaborators Nov 19, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests