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

Shutdown an application launched with bundle exec #40

Closed
nono opened this issue Jun 14, 2011 · 11 comments
Closed

Shutdown an application launched with bundle exec #40

nono opened this issue Jun 14, 2011 · 11 comments

Comments

@nono
Copy link

nono commented Jun 14, 2011

Hi,

I' using foreman 0.18.0 and it seems that it can't stop an application launched with bundle exec.

Example:

$ cat Procfile
rails: bundle exec rails server thin
$ foreman start
15:25:36 rails.1   | started with pid 25455
15:25:41 rails.1   | => Booting Thin
15:25:41 rails.1   | => Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
15:25:41 rails.1   | => Call with -d to detach
15:25:41 rails.1   | => Ctrl-C to shutdown server
15:25:44 rails.1   | >> Thin web server (v1.2.11 codename Bat-Shit Crazy)
15:25:44 rails.1   | >> Maximum connections set to 1024
15:25:44 rails.1   | >> Listening on 0.0.0.0:3000, CTRL+C to stop
^CSIGINT received
15:25:50 system    | sending SIGTERM to all processes
15:25:53 system    | sending SIGKILL to all processes
15:25:53 rails.1   | process terminated
15:25:53 system    | sending SIGTERM to all processes
$ ps aux | grep rails
nono     25458 29.1  2.1  49772 43492 ?        Ssl  15:25   0:08 /home/nono/.rvm/rubies/ruby-head/bin/ruby script/rails server thin
nono     25490  0.0  0.0   4164   856 pts/4    S+   15:26   0:00 grep --color rails
$ foreman start      
15:26:21 rails.1   | started with pid 25500
15:26:27 rails.1   | NOTE: Gem.available? is deprecated, use Specification::find_by_name. It will be removed on or after 2011-11-01.
15:26:27 rails.1   | Gem.available? called from /home/nono/.rvm/gems/ruby-head/gems/jasmine-1.0.2.1/lib/jasmine/base.rb:64.
15:26:27 rails.1   | => Booting Thin
15:26:27 rails.1   | => Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
15:26:27 rails.1   | => Call with -d to detach
15:26:27 rails.1   | => Ctrl-C to shutdown server
15:26:30 rails.1   | >> Thin web server (v1.2.11 codename Bat-Shit Crazy)
15:26:30 rails.1   | >> Maximum connections set to 1024
15:26:30 rails.1   | >> Listening on 0.0.0.0:3000, CTRL+C to stop
15:26:30 rails.1   | Exiting
15:26:30 rails.1   | /home/nono/.rvm/gems/ruby-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server': no acceptor (RuntimeError)
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/thin-1.2.11/lib/thin/backends/tcp_server.rb:16:in `connect'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/thin-1.2.11/lib/thin/backends/base.rb:53:in `block in start'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/rack-1.3.0/lib/rack/handler/thin.rb:13:in `run'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/rack-1.3.0/lib/rack/server.rb:265:in `start'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:70:in `start'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/railties-3.1.0.rc4/lib/rails/commands.rb:54:in `block in <top (required)>'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'
15:26:30 rails.1   |    from /home/nono/.rvm/gems/ruby-head/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `<top (required)>'
15:26:30 rails.1   |    from script/rails:6:in `require'
15:26:30 rails.1   |    from script/rails:6:in `<main>'
/home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:117:in `eof?': Input/output error - /dev/pts/9 (Errno::EIO)
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:117:in `block (2 levels) in run'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:115:in `spawn'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:115:in `block in run'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:114:in `chdir'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:114:in `run'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:102:in `block in fork_individual'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:101:in `fork'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:101:in `fork_individual'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:91:in `block in fork'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:90:in `upto'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:90:in `fork'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:59:in `block in start'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:58:in `each'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/engine.rb:58:in `start'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/lib/foreman/cli.rb:23:in `start'
    from /home/nono/.rvm/gems/ruby-head/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /home/nono/.rvm/gems/ruby-head/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /home/nono/.rvm/gems/ruby-head/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /home/nono/.rvm/gems/ruby-head/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /home/nono/.rvm/gems/ruby-head/gems/foreman-0.18.0/bin/foreman:7:in `<top (required)>'
    from /home/nono/.rvm/gems/ruby-head/bin/foreman:16:in `load'
    from /home/nono/.rvm/gems/ruby-head/bin/foreman:16:in `<main>'
15:26:30 rails.1   | process terminated
15:26:30 system    | sending SIGTERM to all processes

As you can see, the rails server thin is not stopped after the first foreman start and so fails on the second try. I think that foreman kills bundler but not thin. Do you think you can do something about it?

@nono
Copy link
Author

nono commented Jun 14, 2011

#26 looks very similar to this issue.

@mutewinter
Copy link

Having the same problem, here's my error dump

CSIGINT received
21:30:52 system    | sending SIGTERM to all processes
/usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:117:in `eof?': Input/output error - /dev/pts/2 (Errno::EIO)
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:117:in `block (2 levels) in run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:115:in `spawn'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:115:in `block in run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:114:in `chdir'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:114:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:102:in `block in fork_individual'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:101:in `fork'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:101:in `fork_individual'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:91:in `block in fork'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:90:in `upto'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:90:in `fork'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:59:in `block in start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:58:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/engine.rb:58:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/lib/foreman/cli.rb:23:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/foreman-0.18.0/bin/foreman:7:in `'
    from /usr/local/bin/foreman:19:in `load'
    from /usr/local/bin/foreman:19:in `'

@kmamykin
Copy link

For me this the same stacktrace was caused by once of the commands in Procfile crashing b/c of incorrect configuration. Make sure all commands in Procfile can be started on their own.
In fact the it seems like the "in 'eof?': Input/output error" is thrown when the underlying process threw an exception itself.

@kmamykin
Copy link

I am confirming v0.19.0 is not shutting down thin webserver, when it is run with or without bundle exec.
https://gist.github.com/1117047

@foresth
Copy link

foresth commented Aug 2, 2011

I can confirm this issue with 0.19.0. A thin process started with web: bundle exec thin start -p $PORT in Procfile won't shut down.

@kmamykin
Copy link

kmamykin commented Aug 3, 2011

I can not reproduce it on my Mac, my previous repro gist was done on Ubuntu 10.04, latest kernel.

@ocdavid
Copy link

ocdavid commented Aug 13, 2011

Reconfirmed. Thin doesn't get killed for me either upon my ^C to foreman, when run from Procfile exactly as foresth reports.

@blt04
Copy link

blt04 commented Aug 16, 2011

Please also see my comments on #26. Seems to be the same issue.

@seocahill
Copy link

same thing for me

@sdhull
Copy link

sdhull commented Sep 1, 2011

FTW, v0.20.0 shuts down thin just fine for me.

Also, a very similar stacktrace came up when one of my processes daemonized and returned (foreman shut everything down). I had to make it stop daemonizing and I was in much better shape. Cheers!

@ddollar
Copy link
Owner

ddollar commented Nov 8, 2011

Rolling into #94

@ddollar ddollar closed this as completed Nov 8, 2011
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