[PATCH] Pidfile with cluster nodes setting is invalid
Reported by Gabriel Handford | April 29th, 2008 @ 11:55 PM
If you use the pidfile setting with cluster nodes the pid for each process gets written to the same pidfile.
merb -P /var/run/merb-app.pid -c 2 -p 5000
This should write the following pids:
/var/run/merb-app.5000.pid
/var/run/merb-app.5001.pid
In order to support this I added a check for :cluster config and then add the port number to the pid file base.
Merb::Config[:pid_file].gsub(/\.pid$/, ".#{port}.pid")
You can pull this fix from:
http://github.com/gabriel/merb-c...
I also noticed the alive? and kill methods do not use the pidfile config setting, so I patched those to common pid_file and pid_files methods.
Comments and changes to this ticket
-
Gabriel Handford April 30th, 2008 @ 12:15 AM
Maybe instead of a gsub, allow any extension.
ext = File.extname(Merb::Config[:pid_file]) base = File.basename(Merb::Config[:pid_file], ext) dir = File.dirname(Merb::Config[:pid_file]) File.join(dir, "#{base}.#{port}#{ext}")It looks like this is how mongrel_cluster does it.
I updated the fix and spec test.
-
Yehuda Katz (wycats) April 30th, 2008 @ 09:39 PM
- → State changed from new to resolved
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
