This project is archived and is in readonly mode.

#5031 ✓resolved
sudara

Allow -P option to pass named PID file to rails server

Reported by sudara | July 2nd, 2010 @ 01:17 AM | in 3.0.2

This is a 3 line change, adding the ability for Rails::Server to pass an option to Rack::Server.

Rack::Server currently takes a -P option so that a named PID file can be passed.

Rails::Server currently specifies a default for this option:

:pid         => File.expand_path("tmp/pids/server.pid"),

This is problematic: When starting more than one instance of the server, the server.pid is clobbered by the newer server starting up, so the PID file dropped by rails is actually completely useless in a production environment.

Rails 2 exhibited this same problem. The existence of mongrel_cluster mitigated the problem for most in mongrel deploys though a patch was submitted but pushed back to rails 3. Then of course there is unicorn/passenger/etc which is another can of beans.

The default would remain the same with this change. In my opinion, if Rails is going to drop a PID, it needs to be able to do so properly in production - that is, multiple instances need to be able to drop unique PID files. This allows for easily running multiple severs, for example one can then name the PIDs server.5000.pid, server.5001.pid, and so on.

tl;dr Dropping a PID is pointless unless it can be unique, as each instance will write over the PID. This patch allows it to be specified.

Thanks!

Comments and changes to this ticket

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages