Thanks that's helpful, I'm investigating that.

Using the instructions at:

http://mongrel.rubyforge.org/wiki/MongrelCluster#OnBootInitializationSetup

I had a little bash script at /etc/init.d/mongrel_cluster that was copied from
/path/to/mongrel_cluster_gem/resources/mongrel_cluster

That bash script calls mongrel_cluster_ctl with various options. I have added a 
"--clean" option to the "start" condition.  Would it make sense to suggest this 
be added to resources/mongrel_cluster in the actual gem, to not require this 
change?  

However, now I'm trying to set up an intentionally created stale pid, to test 
this feature. I am invoking mongrel_cluster_ctl manually (but in the manner of 
the resources/mongrel_cluster script) with the --clean option. I get this:

****
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/lib/mongrel_cluster/init.rb:83:in
 `unlink': No such file or directory - tmp/pids/mongrel.3000.pid (Errno::ENOENT)
        from 
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/lib/mongrel_cluster/init.rb:83:in
 `start'
        from 
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/lib/mongrel_cluster/init.rb:79:in
 `each'
        from 
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/lib/mongrel_cluster/init.rb:79:in
 `start'
        from 
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/lib/mongrel_cluster/init.rb:232:in
 `run'
        from 
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/command.rb:212:in 
`run'
        from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281
        from /usr/bin/mongrel_rails:18:in `load'
        from /usr/bin/mongrel_rails:18
mongrel_rails cluster::start returned an error.
*****

That was using a mongrel_config.yml file that did have 'cwd' set.  There 
certainly is a tmp/pids/mongrel.3000.pid off of the 'cwd' location.  But 
perhaps the 'unlink' isn't being executed off the 'cwd' location as it ought to 
be?

Is this a bug in mongrel_cluster_ctl --clean, or perhaps just a bug in my 
attempt to duplicate the problem condition and make sure I've solved it? 

Thanks for any help. 

Jonathan



Eden Li wrote:
> Newer versions of mongrel_cluster have a --clean option which will  
> remove stale pids if it finds them.  Provide that option to  
> mongrel_rails cluster::* in your scripts.
>
> On Mar 5, 2008, at 8:59 AM, Jonathan Rochkind wrote:
>
>   
>> So I am using the instructions here to have mongrel_cluster start my
>> various mongrel-deployed apps on server boot.
>> http://mongrel.rubyforge.org/wiki/MongrelCluster
>>
>> There is a problem mentioned here:
>> http://www.ruby-forum.com/topic/105849
>>
>> In summary---if the server (or the mongrel processes) die ungracefully
>> leaving their pids behind, then on next boot, mongrel_cluster won't
>> succesfully start them up, choking on the leftover pids.
>>
>> What is the reccommended solution to this?  I'd like to have my  
>> mongrels
>> automatically start on boot, in a way that forces them to start even  
>> if
>> there are stale pids. Thanks for any advice!
>>
>> [ PS: I just discovered this problem the hard way, when my server
>> unexpetedly lost power, and my production apps failed to start up on  
>> the
>> next boot!  Very unpleasant. ]
>>
>> Jonathan
>>
>>
>> -- 
>> Jonathan Rochkind
>> Digital Services Software Engineer
>> The Sheridan Libraries
>> Johns Hopkins University
>> 410.516.8886
>> rochkind (at) jhu.edu
>>
>> _______________________________________________
>> Mongrel-users mailing list
>> Mongrel-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-users
>>     
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>   

-- 
Jonathan Rochkind
Digital Services Software Engineer
The Sheridan Libraries
Johns Hopkins University
410.516.8886 
rochkind (at) jhu.edu

_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to