Hi,
I've just started setting up Dovecot 1.0.1, and made an error in my configuration, which I think has found a potential problem in Dovecot.
I'm using PostgreSQL authentication, and set the database host to "localhost", which PostgreSQL doesn't listen on, so libpq is throwing the standard "is the server running?" message.
The problem, however, is Dovecot isn't seeming to understand this, and is endlessly looping, trying to query it every 5 seconds. My client (telnet during testing) is simply sitting there waiting for a response, which it's never going to get. After about 5 minutes, Dovecot killed the connection, saying "* BYE Disconnected for inactivity."
If this was from an IMAP client, I'm guessing the client would time-out after so long when it doesn't get a response back. Wouldn't it be more sensible for Dovecot to try PostgreSQL, say, 3 times. If unsuccessful, send the client an "internal server error" or something similar? Otherwise if the database server failed, and the client tries to connect, it'd be waiting for at least a minute (or whatever the standard time-out interval is) before failing, whereas it'd be better to see almost instantly if the server's down.
Regards,
Andy.
Log output:
dovecot: Jul 01 11:31:03 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:03 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:03 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:08 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:08 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:08 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:13 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:13 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:13 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:18 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:18 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:18 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:23 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:23 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:23 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:28 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:28 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:28 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:33 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:33 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:33 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:38 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:38 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:38 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:43 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:43 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:43 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:48 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:48 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:48 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:53 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:53 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:53 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:31:58 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:31:58 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:31:58 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:32:03 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:32:03 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:32:03 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:32:08 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:32:08 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:32:08 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:32:13 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:32:13 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:32:13 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:32:18 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:32:18 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:32:18 Error: auth(default): TCP/IP connections on port 5432? dovecot: Jul 01 11:32:23 Error: auth(default): pgsql: Connect failed to <database>: could not connect to server: Connection refused dovecot: Jul 01 11:32:23 Error: auth(default): Is the server running on host "localhost" and accepting dovecot: Jul 01 11:32:23 Error: auth(default): TCP/IP connections on port 5432?