Worker restarts even when idle

Eric Wong normalperson at
Sun Oct 11 21:32:31 EDT 2009

Jeremy Evans <jeremyevans0 at> wrote:
> Eric,
> Thanks for the 0.93.3 release.  I'm now able to test my apps with unicorn.
> If I have an idle application, the master program restarts the workers
> every timeout seconds.  Is this the expected behavior, and if so, is
> there a reason for it?  Would you be opposed to changing it so that
> the master doesn't restart workers that haven't had any activity in
> the last timeout seconds?

Idle as in no clients connected (and not long-poll/Comet idle)?
Definitely not expected behavior...

Can you try playing the following on OpenBSD and seeing if
the ctimes match for before and after?

  require 'tempfile'
  foo = nil
  before = foo.stat
  foo.chmod 1
  sleep 1
  foo.chmod 0
  after = foo.stat

  p [ before.ctime, after.ctime ]

If they're the same, can you also try syswrite(".") instead of chmod and
see if that does anything?

I wonder if OpenBSD is not implementing st_ctime changes properly,
I understanding is that st_ctime should change for any FS-related
operations, from the Linux stat(2) manpage:

  The field st_ctime is changed by writing or by setting inode
  information (i.e., owner, group, link count, mode, etc.).

Likewise, the OpenBSD manpage:

  st_ctime    Time when file status was last changed (inode data
              modification).  Changed by the chmod(2), chown(2),
              link(2), rename(2), unlink(2), utimes(2), and write(2)
              system calls.

Note that the OpenBSD manpage doesn't explicitly say fchmod(2), just
chmod(2), so if the above didn't work, maybe the following does?

  require 'tempfile'
  foo = nil
  before = foo.stat
  File.chmod(1, foo.path)
  sleep 1
  File.chmod(0, foo.path)
  after = foo.stat

  p [ before.ctime, after.ctime ]

This might be a bug in OpenBSD, but I'd be willing to make a workaround

Eric Wong

More information about the mongrel-unicorn mailing list