#137 new
Guido De Rosa

empty pid files should be ignored/deleted instead of raising Thin::PidFileExist

Reported by Guido De Rosa | August 11th, 2010 @ 11:58 AM

When starting in daeomonized mode, Thin checks the pidfile, read the number in it and, if that Process ID is already running, a Thin::PidFileExist exception is raised, which is correct.

If the pid in the pidfile does not correspond to any running process, the pidfile is considered "stale", and is deleted. This is correct too.

But sometimes it may happen to find an empty pidfile, for example after a power failure when the filesystem was not sync'ed. In this case, Thin believes that the process ID is 0, which is always running (the OS kernel?) :-P

This is certainly not correct! A pidfile with no valuable data in it should be simply ignored and/or deleted.

Here the error messages from Thin:

/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/daemonizing.rb:167:in `remove_stale_pid_file': thin.pid already exists, seems like it's already running (process ID: 0). Stop
the process or delete thin.pid. (Thin::PidFileExist)
        from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/daemonizing.rb:40:in `daemonize'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:55:in `start'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
        from /usr/local/bin/thin:19:in `load'
        from /usr/local/bin/thin:19:in `<main>'

Thanks in advance!

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket