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

"rerun foreman start", the first re-run fails with "Errno::EADDRINUSE" (Ubuntu 12.10) #41

Open
gridsane opened this issue Jul 3, 2013 · 8 comments

Comments

@gridsane
Copy link

gridsane commented Jul 3, 2013

rerun foreman start

17:31:47 [rerun] Heroku.dev launched
17:31:47 web.1  | started with pid 22808
17:31:49 web.1  | [2013-07-03 17:31:49] INFO  WEBrick 1.3.1
17:31:49 web.1  | [2013-07-03 17:31:49] INFO  ruby 1.9.3 (2012-04-20) [x86_64-linux]
17:31:49 web.1  | [2013-07-03 17:31:49] INFO  WEBrick::HTTPServer#start: pid=22811 port=5000
17:31:50 [rerun] Watching . for **/*.{rb,js,css,scss,sass,erb,html,haml,ru} using Linux adapter
r17:31:56 [rerun] Restarting
17:31:56 [rerun] Sending signal TERM to 22799
SIGTERM received
17:31:56 system | sending SIGTERM to all processes
17:32:00 [rerun] Sending signal INT to 22799
SIGINT received
17:32:01 system | sending SIGKILL to all processes
17:32:02 [rerun] Sending signal KILL to 22799

17:32:02 [rerun] Heroku.dev restarted
17:32:02 web.1  | started with pid 22892
17:32:04 web.1  | [2013-07-03 17:32:04] INFO  WEBrick 1.3.1
17:32:04 web.1  | [2013-07-03 17:32:04] INFO  ruby 1.9.3 (2012-04-20) [x86_64-linux]
17:32:04 web.1  | [2013-07-03 17:32:04] WARN  TCPServer Error: Address already in use - bind(2)
17:32:04 web.1  | /usr/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/utils.rb:85:in `block in create_listeners'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/utils.rb:82:in `each'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/utils.rb:82:in `create_listeners'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/server.rb:82:in `listen'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/server.rb:70:in `initialize'
17:32:04 web.1  |   from /usr/lib/ruby/1.9.1/webrick/httpserver.rb:45:in `initialize'
17:32:04 web.1  |   from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `new'
17:32:04 web.1  |   from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `run'
17:32:04 web.1  |   from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
17:32:04 web.1  |   from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
17:32:04 web.1  |   from /var/lib/gems/1.9.1/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
17:32:04 web.1  |   from /usr/local/bin/rackup:23:in `load'
17:32:04 web.1  |   from /usr/local/bin/rackup:23:in `<main>'
17:32:04 web.1  | exited with code 1
17:32:04 system | sending SIGTERM to all processes

"foreman" recieve SIGKILL, so "rackup" not killed by "foreman" (i can see it in a process list on port 5000), so "foreman" can't start second time.

Maybe time intervals between signals should be in options?

@alanrubin
Copy link

I'm experiencing the same issue - any ideas on how to fix that ? I have tried multiple options for rerun (such as --signal KILL) but could not find any solution for it.

@alexch
Copy link
Owner

alexch commented Jan 8, 2014

Sorry, I haven't worked on this issue yet... What version of foreman are
you using?

I would think --signal KILL would do it -- or even the normal TERM --
but a quick google shows other people are having trouble with foreman not
restarting its subprocesses gracefully...

On Wed, Jan 1, 2014 at 3:52 AM, Alan Rubin notifications@github.com wrote:

I'm experiencing the same issue - any ideas on how to fix that ? I have
tried multiple options for rerun (such as --signal KILL) but could not find
any solution for it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-31421881
.

Alex Chaffee - alex@stinky.com
http://alexchaffee.com
http://codelikethis.com
http://twitter.com/alexch

@alpemaca
Copy link

Same issue here. My foreman version is 0.63.0

Hope it helps!, thanks

@alexch
Copy link
Owner

alexch commented Mar 6, 2014

Here's the relevant code: https://github.com/alexch/rerun/blob/master/lib/rerun/runner.rb#L218-L241

It looks like foreman is responding to SIGINT by sending SIGKILL to all its children. But it takes longer than 2 seconds for the children to die (how morbid!) so we escalate to sending SIGKILL and restart forecefully. Yeah, maybe increasing the SIGINT timeout would do it.

I'll bump up both timeouts to 5 seconds and push to master; you can then clone it locally and run rake install and see if that's enough.

A better solution would be to expand the --signal semantics to something like this:

--signal TERM:4,INT:2,KILL

which would do the current logic.

@Dakta
Copy link

Dakta commented Aug 30, 2014

Stable Mac gems for rerun (0.10.0) and foreman (0.60.0) appear to still manifest this issue. Should those gems be more recent?

@baelter
Copy link

baelter commented Dec 21, 2021

Seeing this on ubuntu 7 years later :(

@dentarg
Copy link

dentarg commented Dec 17, 2022

This is probably happening due to ddollar/foreman#779 in foreman, that's address by this PR: ddollar/foreman#780 – that PR has been released in an foreman fork called overman

@mculp
Copy link

mculp commented Jan 3, 2023

ha, same problem on overmind :[

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

8 participants