jnorell / dbmail-postfix-policyd

A Postfix policy server to check DBMail quotas
GNU General Public License v2.0
0 stars 1 forks source link

DBD rhobustness #1

Open jnorell opened 13 years ago

jnorell commented 13 years ago

I left dbmail-postfix-policyd running idle over the weekend, connected to a postfix back end. When I set pointed postfix to it this morning, it immediately died with:

DBD::Pg::st execute failed: server closed the connection unexpectedly
 This probably means the server terminated abnormally
 before or while processing the request. at ./dbmail-postfix-policyd line 153.

Need to make the dbi pieces more rhobust: attempt reconnect to server, check for errors on function calls, etc.

jnorell commented 13 years ago

Reproduced that error again (now on line 183) by leaving dbmail-postfix-policyd running overnight without postfix forwarding mail to it. No errors in postgresql main.log. Another active dbmail-postfix-policyd ran overnight connected to the same database backend, without problem. Definitely something related to idle connections here.

jnorell commented 13 years ago

Still happening even after yesterday's commit which intended to fix this. (error on line 225 now)

jnorell commented 13 years ago

Still not fixed on the idle postgres connection, though it's improved. It no longer dies, but it does stop checking, with messages like:

dbmail_v1_quota_check: checking addr@domain (recurse_depth 0) DBD::Pg::st execute failed: no connection to the server at ./dbmail-postfix-policyd line 262. dbmail_v1_quota_check: alias_sth: DBI::st=HASH(0x86c1dd8)->errstr

A HUP will reconnect to the database and all starts working again.

jnorell commented 13 years ago

In more digging, this is probably an tcp keepalive issue - I'll see about setting SO_KEEPALIVE on the database socket.