On Tue, Jun 4, 2013 at 2:32 PM, Xinhuan Zheng <email@example.com
> I have seen in other web servers when apachectl starts, there is no "connect lost contact" error but it did happen when apachectl stops.
If your server does not receive constant requests, you may see this error on shutdown because cached database handles are being destroyed but the connection to the database has already timed out.
> If child process uses ping the inherited database handle and it is ping-able, then the child process may use it. That'll be a problem.
The debugging log you showed us makes me think that won't happen. It looks like the handle fails immediately when used after a fork.
> When child process exits, it calls rollback if AutoCommit is off, but when another new child process is just born and uses its connection to send
> database updates, will that rollback interfere with new child process attempt to update database?
If the same connection was being used in multiple processes, many things could go wrong, including that. However, Since the connections die immediately when you use them after a fork, this won't happen.
> Is the rollback necessary?
It's very necessary. Otherwise, if your code throws an uncaught exception in the middle of some database work, the next request would reuse the same handle with uncommitted changes left on it. In my opinion, this is the most important thing about Apache::DBI.
I understand you're worried about it. I should be able to send you a patch to try within a few days, so you can wait for that if you want. Or you can try to fix it yourself. My plan is to replace that line of code I showed with some code that
checks current_callback() to make sure we're not in a startup phase.