unicorn 1.1.x never-ending listen loop IOError exceptions

David Nghiem david at zendesk.com
Tue Mar 22 20:04:48 EDT 2011


On Tue, Mar 22, 2011 at 2:39 PM, Eric Wong <normalperson at yhbt.net> wrote:

>> I don't get any other exceptions.  I've found other people have this
>> "IOError: closed stream" error coupled with "Errno::EMFILE" but we
>> have plenty of file-descriptors left.
>
> No Errno::EBADF errors at all?

I didn't check before or after the block of Errno::IOError errors,
there were enough IOError logs to fill up 40gb of disk.  I'll capture
the entire deleted log next time.


> <snip>  It looks like log reopening failed, below:
>
>> ruby    15209 zendesk    1w   REG              252,0           0
>> 3015360 /data/zendesk/log/unicorn.stdout.log
>> ruby    15209 zendesk    2w   REG              252,0       24585
>> 3015203 /data/zendesk/log/unicorn.stderr.log-20110110 (deleted)
>> ruby    15209 zendesk    3w   REG              252,0 61617590073
>> 3015097 /data/zendesk/log/unicorn.log-20110110 (deleted)
>
> Permissions issue during log rotation?  Are you doing "killall -USR1
> unicorn" by any chance or sending a bunch of USR1 signals faster than
> unicorn can process them?
>
> Try just sending one USR1 to the master process and letting the master
> signal the workers.

We rotate logs once a night using logrotate.  There's a post-rotate
hook that sends USR1 once to the master.   There are three log files
but logrotate is run with the sharedscripts option so only one hook
runs.  The log dirs and unicorn processes are run as the same non-root
user.

I'll run an lsof on the healthy workers next time to see if they have
the same deleted log file descriptors.

Are the IOError exceptions and failure to rotate logs related?  My
wild guess was this specific worker's unix socket got corrupted
somehow.


More information about the mongrel-unicorn mailing list