That looks like that will do exactly what I need.  I tried it my code and it
caught the server timeout and wrote an error to the log file using
$r->server->log_error, but when I try to do $r->child_terminate, I get this
error:

[Tue Jul 31 11:16:35 2001] [error] Can't locate object method
"child_terminate"
via package "Apache" (perhaps you forgot to load "Apache"?) at
DatabaseStuff.pm line 56.

But I have loaded Apache.  Would my running Apache in a win32 environment
(which uses threads instead of processes) have anything to do with that?

Curtis H.

----- Original Message -----
From: "Geoffrey Young" <[EMAIL PROTECTED]>
To: "'Curtis Hawthorne'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, July 31, 2001 10:04 AM
Subject: RE: mod_perl/DBI problem


<snip>

> the way most people handle this is by separating out the connect routine,
> wrapping it in an eval, and calling $r->child_terminate if $dbh is undef.
> It's not ideal, but it takes that child out of the pool instead of having
it
> lingering with a bad connection for the next 5000 requests (or whatever
your
> MaxRequestPerChild is).
>
> this is what I use for Oracle:
>
>   eval {
>     $dbh = DBI->connect($dbase, $user, $pass,
>       {RaiseError => 1, AutoCommit => 1, PrintError => 1});
>   };
>
>   if ($@) {
>     # if we could not log in, then there is the possibility under
>     # Apache::DBI that the child may never recover...
>     $r->server->log_error("Doh! We may have a TNS error: $DBI::errstr ",
>                           "Scheduling child $$ termination NOW...");
>     $r->child_terminate;
>   }
>
> HTH
>
> --Geoff
>

Reply via email to