[Mongrel] mongrel not daemonizing for me..

Eden Li eden at mojiti.com
Fri Jun 29 00:38:36 EDT 2007


On 6/29/07, aaron smith <beingthexemplarylists at gmail.com> wrote:
> config.run.join is actually what keeps it running. if I do a "ps x | grep
> mongrel" the process shows up.. but if I don't run config.run.join it
> doesn't keep running..

Yeah, I guess I misunderstood how Daemon.daemonize works, sorry about that.

> The problem still is that mongrel seems to be daemonizing correctly but
> the application doesn't perform as expected, (not doing remoting
> correctly).. A request comes in and no response is ever returned..
>
> any ideas?

I wrote a little test script that daemonizes DirHandler in the same
way you're daemonizing RUBYAMF::MongrelServlet:

#!/usr/bin/env ruby
require 'rubygems'
require 'mongrel'
c = Mongrel::Configurator.new(:host => '127.0.0.1') do
  listener(:port => 8000) do
    uri("/", :handler => Mongrel::DirHandler.new('.'))
  end
end
c.daemonize(:cwd => Dir.pwd, :log_file => 'log')
c.run.join

This daemonizes correctly, but the log file bloats quickly with messages like:
!!!!!! UNHANDLED EXCEPTION! closed stream.  TELL ZED HE'S A MORON.

Going back to the docs for daemonize, I read:

"You must call this before frameworks that open files as otherwise the
files will be closed by this function."

So I put the daemonize line into the config block right before the
listener block (removing the ref to c, of course), and everything
works as expected.

Maybe try daemonizing before you initialize your RUBYAMF handler?


More information about the Mongrel-users mailing list