Forum OpenACS Q&A: Better handling of PostgreSQL shutdown/startup

I'm running an instance of OpenACS at hub.org, and generally have good things to say about them and their service.

Every so often, for reasons that I don't understand, they seem to restart their PostgreSQL server.  Why and when is an issue that I'll take up with them separately.  What I'm curious about is the fact that the PostgreSQL driver doesn't seem to be smart enough to reconnect as necessary if the database server dies and restarts.

If the driver *is* smart enough to reconnect, then perhaps it's just a startup issue on my machine.  But if it isn't this smart, then I wonder how hard it would be to to get AOLServer to reconnect.

Collapse
Posted by Jonathan Ellis on
It's SUPPOSED to reconnect, but I've seen it not work there too.  Unfortunately the bug isn't very reproducible for me -- more often than not, it works as it should.
Collapse
Posted by Lamar Owen on
There are two distinct situations here.

One is where an individual backend dies -- this is properly reconnected.

Two is when the postmaster dies -- this is not currently reconnected.  I am looking at ways of doing this, but it is going to take some time to properly troubleshoot.

In the interim, ask Marc (or whoever your contact is) at hub to coordinate shutdown of AOLserver with postmaster restart -- they're probably rolling their logs.  Simply shutdown AOLserver first, then restart postmaster, then restart AOLserver.  You do wind up with 30 seconds to a minute of downtime as OpenACS reloads.

This is one of my biggest TODO items for the post-3.5 release of the nspostgres driver.

Collapse
Posted by Paul Juliano on
Hi,

Was this problem resolved in the 4.0 release of nspostgres? AOLserver hangs whenever the postgres server is restarted or when it stops unexpectedly.

Thanks.

--Paul