This project is archived and is in readonly mode.
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
-
sudara July 2nd, 2010 @ 01:25 AM
- Tag changed from rails3 server startup, bug to rails3 server startup, bug, patch
Patch attached!
-
José Valim July 7th, 2010 @ 10:33 PM
- Assigned user set to José Valim
- Milestone cleared.
- Importance changed from to Low
-
Repository July 8th, 2010 @ 10:03 PM
- State changed from new to resolved
(from [e848ab527ca9da1a6cf2a8485163f01daf3f66d1]) Allow a PID file to be specified to rails server [#5031 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/e848ab527ca9da1a6cf2a8485163f0...
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
- 5031 Allow -P option to pass named PID file to rails server (from [e848ab527ca9da1a6cf2a8485163f01daf3f66d1]) Allow a...