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

PID file doesn't get cleaned up when killing heel #15

Closed
justindhill opened this issue Nov 17, 2013 · 1 comment
Closed

PID file doesn't get cleaned up when killing heel #15

justindhill opened this issue Nov 17, 2013 · 1 comment

Comments

@justindhill
Copy link

I checked into it and it looks like a simple missing File.unlink. Fixing it and submitting a pull request.

$ heel -p 8080 -r ./public -d
Launching your browser at http://0.0.0.0:8080/

$ heel -k -p 8080
Sending TERM to process 45297
Done.

$ heel -p 8080 -r ./public -d
ERROR: PID File /Users/jhill/.heel/heel.8080.pid already exists. Heel may already be running.
ERROR: Check the Log file /Users/jhill/.heel/heel.8080.log
ERROR: Heel will not start until the .pid file is cleared (`heel --kill --port 8080' to clean it up).

$ heel -k -p 8080
Sending TERM to process 45297
Unable to kill process with pid 45297.  Process does not exist.  Removing stale pid file.
Done.
@copiousfreetime
Copy link
Owner

@justindhill Can you tell me what version of ruby you are using and what version of rack? I attempted to duplicate it and it only happens on ruby 2.0, and it appears that the TERM signal is getting swallowed.

Ruby 1.9

jeremy@ample:~/Projects/heel ruby-1.9.3-p448@heel master % ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.1]

jeremy@ample:~/Projects/heel ruby-1.9.3-p448@heel master % heel -r tasks/ -d -p 8080
Launching your browser at http://0.0.0.0:8080/

jeremy@ample:~/Projects/heel ruby-1.9.3-p448@heel master % ls -l ~/.heel/
total 24
-rw-r--r--  1 jeremy  staff   662 Nov 19 17:30 heel.8080.log
-rw-r--r--  1 jeremy  staff     4 Nov 19 17:30 heel.8080.pid

jeremy@ample:~/Projects/heel ruby-1.9.3-p448@heel master % heel -k -p 8080
Sending TERM to process 5130
Done.

jeremy@ample:~/Projects/heel ruby-1.9.3-p448@heel master % ls -l ~/.heel/
total 16
-rw-r--r--  1 jeremy  staff   662 Nov 19 17:30 heel.8080.log

Ruby 2.0 - it appears to take 2 kills for it to die and doesn't cleanup.

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master %  heel -p 8080 -r ./tasks -d
Launching your browser at http://0.0.0.0:8080/

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master %  heel -k -p 8080
Sending TERM to process 5527
Done.

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master % ps auxwww | grep 5527
jeremy          5545   0.0  0.0  2432768    600 s006  R+    5:36PM   0:00.00 grep 5527
jeremy          5527   0.0  0.1  2495144   9688   ??  S     5:36PM   0:00.02 /opt/rubies/ruby-2.0.0-p247/bin/ruby /Users/jeremy/.gem/repos/ruby-2.0.0-p247/heel/bin/heel -p 8080 -r ./tasks -d

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master %  heel -k -p 8080
Sending TERM to process 5527
Done.

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master % ps auxwww | grep 5527
jeremy          5581   0.0  0.0  2432768    600 s006  R+    5:36PM   0:00.00 grep 5527

jeremy@ample:~/Projects/heel ruby-2.0.0-p247@heel master % ls -l ~/.heel/heel.8080.*
-rw-r--r--  1 jeremy  staff  70 Nov 19 17:36 /Users/jeremy/.heel/heel.8080.log
-rw-r--r--  1 jeremy  staff   4 Nov 19 17:36 /Users/jeremy/.heel/heel.8080.pid

The Pid management is in actuality delegated to Rack::Server so we could fix this here, but there may be a more fundamental issue with Rack on Ruby 2.0 with signal handling. I think I'm going to investigate.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 15, 2014
## Version 3.1.3 - 2013-11-26
* URL encode the links to files [#14](copiousfreetime/heel#14)
* Fix pid file cleanup on ruby 2.0 [#15](copiousfreetime/heel#15)

## Version 3.1.2 - 2013-10-16
* Fix usage of Mime::Types [#12](copiousfreetime/heel#12) [#13](copiousfreetime/heel#13)

## Version 3.1.1 - 2013-09-29
* Fix request logging [#10](copiousfreetime/heel#10)
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 17, 2014
## Version 3.1.3 - 2013-11-26
* URL encode the links to files [#14](copiousfreetime/heel#14)
* Fix pid file cleanup on ruby 2.0 [#15](copiousfreetime/heel#15)

## Version 3.1.2 - 2013-10-16
* Fix usage of Mime::Types [#12](copiousfreetime/heel#12) [#13](copiousfreetime/heel#13)

## Version 3.1.1 - 2013-09-29
* Fix request logging [#10](copiousfreetime/heel#10)
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
## Version 3.1.3 - 2013-11-26
* URL encode the links to files [#14](copiousfreetime/heel#14)
* Fix pid file cleanup on ruby 2.0 [#15](copiousfreetime/heel#15)

## Version 3.1.2 - 2013-10-16
* Fix usage of Mime::Types [#12](copiousfreetime/heel#12) [#13](copiousfreetime/heel#13)

## Version 3.1.1 - 2013-09-29
* Fix request logging [#10](copiousfreetime/heel#10)
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

2 participants