Forum OpenACS Q&A: Openacs DB connection issue

Posted by Jerome M on

I have a OACS 5.1.0 running with Postgres as my DB. Whenever we encounter DB problems like connection and DB restart OACS doesnt recover from that.

Can anyone suggest something or is there a way in OACS to re-connect just incase such problem occurs..


Posted by Rocael Hernández Rizzardini on
Its the way the driver works, and the only way I've seen to deal with that is to restart your server. Anyway, if you cannot guarantee your db connection, you are in troubles.
Posted by Andrew Piskorski on
Anytime you restart your RDBMS, you must then restart AOLserver once your RDBMS is back up and working.

In principle it would probably be feasible to enhance the AOLserver database handling code to recover from a restarted RDBMS, but in practice the need for that is rare, and simply restarting AOLserver is an easy and fairly non-intrusive way to handle it.

Rocael is right, if you are frequently encountering problems that force you to restart your RDBMS, something is very wrong; you need to figure out what and fix it.

Posted by Jade Rubick on
The easiest way to do this (I think) would be to use the keepalive script in etc/keepalive.

It's supposed to work, although I've had some issues with it. It's worth looking at.

Posted by Malte Sussdorff on
We use keepalive for all our servers and it works well. Sadly there is an interesting thing to note though. If the DB is down while OpenACS tests for the DB (bootstrap) but comes up right afterwards, the dbtest.tcl script works (it returns success), but OpenACS is still down. Haven't detected how and why this happened yet, but thought I let you know nevertheless.

If you run more than one server on your machine, schedule the keepalive scripts for each server to a different minute. Otherwise, if you restart your database, all servers want to start at the same time, which will take longer for each so your keepalive schedule (I call every 4 minutes) might be to tight for the server to come up properly.