[Dovecot] Handling ENFILE

Timo Sirainen
Mon, 13 Apr 2009 22:30:13 -0000

On Mon, 2009-04-13 at 14:29 -0500, Mike Abbott wrote:
> My mail server consumed all of its configured file table slots and
> started returning ENFILE ("Too many open files in system") for
many
> operations.  This wreaked havoc with dovecot-1.1.13.  Here are some
> areas where dovecot should detect and more gracefully handle ENFILE
> error returns:

I also just tried making nfs_safe_open() fail randomly and reproducing
these.

> 1.  Deliver should report an error more helpful than "Unknown internal
> error" when fdatasync_path fails:
> deliver(user): Apr 10 14:53:20 Error: fdatasync_path(/Volumes/MailData/
> user/new) failed: Too many open files in system
> deliver(user): Apr 10 14:53:20 Info: msgid=<...>: save failed to
> INBOX: BUG: Unknown internal error

http://hg.dovecot.org/dovecot-1.1/rev/576e77047959

> 2.  Index files should not be fscked when they could not be opened due
> to ENFILE:
..
> 3.  Dovecot should not crash when mail transaction logs become
> corrupt, or appear to have become corrupt due to ENFILE.

I made nfs_safe_open() return failures randomly and found all kinds of
bugs with it. I committed several fixes to hg, but I still get some
weird errors once in a while, I'll try to debug more later..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL:
<http://dovecot.org/pipermail/dovecot/attachments/20090413/05f2b0e5/attachment-0002.bin>