[Dovecot] EAGAIN in dict proxy

Richard Platel RPlatel at tucows.com
Wed Jan 15 23:29:32 EET 2014


Hello,

We’re using a custom program to manage quotas talking to dovecot via the dovecot dict proxy protocol over a unix socket:

plugin {
  quota = dict:User quota::proxy:/var/run/auth_proxy_dovecot/quotasocket:quota
}

Dovecot gets slammed with quota requests periodically, seemingly because Thunderbird thought it would be a good idea to hardcode having a quota check at 45 seconds past the minute, and thus every Thunderbird client makes several GETQUOTAROOT requests simultaneously.

This causes dovecot to make many client connections to the quota proxy, and many of them fail with EAGAIN.  In the log we see:

Jan 15 16:52:46 imap25 dovecot: imap(rplatel at tucows.com): Error: net_connect_unix(/var/run/auth_proxy_dovecot/quotasocket) failed: Resource temporarily unavailable

And the client gets:
* QUOTAROOT Spam "User quota"[0d][0a]
* QUOTA "User quota" ()[0d][0a]
* BAD Internal quota calculation error[0d][0a]
19 OK Getquotaroot completed.[0d][0a]

Thunderbird transparently disconnects and reconnects at this point but obviously this is not ideal.

Writing some toy programs, I found that even making a forked server with several processes doing nothing but accept()ing on the listening socket, with a high number for the listen queue, it’s easy to overwhelm it with simultaneous clients who then get EAGAIN.  If the clients do indeed immediately try again, they are successful. (An INET listening socket does not seem to have this problem, incidentally)

All of this is a long-winded way of saying that I believe in lib-dict/dict-client.c:client_dict_connect() the call to net_connect_unix should be a call to net_connect_unix_with_retries() with a small timeout.

It would also be useful for us if an INET socket could be used.




More information about the dovecot mailing list