Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
justindhill opened this Issue · 1 comment

2 participants

@justindhill

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

@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.

@copiousfreetime copiousfreetime closed this issue from a commit
@copiousfreetime Fix pid file cleanup when running on ruby 2.0
- only spawn a server thread in the foreground mode
- at_exit handlers called from a thread in a forked
  process in ruby 2.0 appear to not be called.
- Closes #15, Closes #16
7692508
@jsonn jsonn referenced this issue from a commit in jsonn/pkgsrc
taca Update heel 3.1.3.
## 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)
2d9bf19
@jsonn jsonn referenced this issue from a commit in jsonn/pkgsrc
taca Update heel 3.1.3.
## 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)
d9933eb
@jsonn jsonn referenced this issue from a commit in jsonn/pkgsrc
taca Update heel 3.1.3.
## 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)
f9a3caf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.