On Mon, 15 Sep 2003, H. Steuer wrote:
> hello guys,
>
> after upgrading DBD::mysql from 2.1026 to 2.9002 i ran into the problem
> that after a fork(), the child looses connection to the database. i've
> read the discussion on this list about multiple access on a single db
> handle, but this is how fork() is working. due to internal issues, i
> cant connect to the database AFTER the fork(). i dont see why this
This behaviour was not changed, per se; however, It might be that the
chage to the auto-reconnect behaviour is exposing a bug in your code. In
2.1026 if DBD::mysql got a "Server has goin away" error message,
DBD::mysql would just go and reconnect to the database for you and
basically ignore the error. The problem with this is that any locks would
be lost and the application would not know it.
> behaviour was changed, as if one just lets the parent die to daemonize a
> process, things are fine. its how fork() works and if one would not like
Well did you set InactiveDestroy? Because if you do not, when that
connection goes out of scope in the parrent, it will call the DESTROY
method which will disconnect from the server.
And FWIW, I have seen weird behaviour when 2 processes try to access a
shared $dbh concurrently.
Rudy