At 11:22 AM -0500 3/21/03, [EMAIL PROTECTED] wrote:
We are using the RDB module in Perl to access an RDB database on the same machine. The problem that I'm having is that if there is
an error in the script after the connect statement, then Apache will stay connected to the database indefinately.

Sounds like you're getting bitten by mod_perl's persistent nature. When the perl program errors out the apache/mod_perl process it was running under doesn't die, and sometimes doesn't get properly cleaned up after. That means that while the perl code's dead, the connection to the database is still alive and thus holding the locks. This can happen if the perl code stores the DB handle in a global that's shared across CGI invocations, since that global won't get destroyed when the CGI connection ends.


What you should do is see about wrapping some error handling that forces a disconnect on the handle at exit, or at least don't store the handle in a global so it goes out of scope and gets cleaned up properly.

It's also possible to change over to using AutoCommit to make each SQL statement commit at the end, but that's generally a nasty thing to do and I don't recommend it.

You may also want to set the maximum lifetime of Apache processes so they die and get respawned with some frequency so that locks don't get held for too long if something does go wrong.

FWIW, this isn't particularly RDB or VMS specific--you can make it happen with almost any DB with real locks.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to