in reply to DBD::mysql with a forked processes caused lost MySQL connection unless mysql_auto_reconnect is set?

Yeah, you can't fork with an open database connection. There are open sockets there, and XS structures. You have to open the database connection AFTER you fork.
  • Comment on Re: DBD::mysql with a forked processes caused lost MySQL connection unless mysql_auto_reconnect is set?

Replies are listed 'Best First'.
Re: Re: DBD::mysql with a forked processes caused lost MySQL connection unless mysql_auto_reconnect is set?
by drewhead (Beadle) on Jan 24, 2004 at 18:54 UTC
    But all of my objects are constructed after the fork?
      Your code does a "use TEST" before the fork, which will compile TEST and run all of the code in TEST's "main" section, including the part that opens a db connection.
        Ahhh, so...

        I should be able to fix this by simply moving the use inside of the fork? That doesn't seem to work. I guess even if the use is inside of wakeup() it's still being compiled before forking? Seems I'm a bit confused on what's happening under the covers when forking. Time to do some reading, any suggestions?

        or I can move the db connection call out of the "main" section of TEST.pm. That does work.

        Cool, thanks for the help perrin.