> The answers I have received (Thanks!) are unfortunately not addressing
> my problem, as I was not clear enough in my description. The forked
> threads are not using mysql. All they do is call
> Mail::Sendmail::sendmail and exit. Only the main thread calls mysql.
> This is why I don't understand why the connection is being lost. Even
> more odd, the connection only seems to be lost during a single query,
> then is magically found again for the rest of the queries. Moreover, the
> query which creates the error is not consistent: it happens on different
> queries in different subroutines, but only once during the rather short
> executeion of the script. Any ideas?
> Thanks again!
I did not watch this thread, so excuse me if I'm posting the same again.
I assume that you fork processes having open connection for MySQL server,
and after child processes die, you have unexpected results in your
parent process, this is from DBI docs:
This attribute can be used to disable the database
related effect of DESTROY'ing a handle (which would
normally close a prepared statement or disconnect from
the database etc). It is specifically designed for use
in UNIX applications which 'fork' child processes.
Either the parent or the child process, but not both,
should set InactiveDestroy on all their handles. For a
database handle, this attribute does not disable an
explicit call to the disconnect method, only the
implicit call from DESTROY.
Hope this help.