H. Steuer wrote:
> thanks for your answer. in fact thats how fork() is supposed to be.
> if its a good idea or not to share handles depends on various things
> and exceeds the topic of this discussion. i just wonder why this
> module was working as expected and this behaviour was changed.
I am not so sure, whether reusing a MySQL connection in a forked child is
supposed to work. We have to distinguish between reusing sockets and reusing
If the parent has a socket and forks a child, then the operating system
*knows*, that the socket is still open. In other words, the first close() is
just internally and suppress sending a shutdown to the remote end.
If the parent has a database connection and forks a child, then the database
driver *does not know* that the connection exists in a separate process.
This won't matter, if a disconnect() is simply a shutdown of the socket: The
operating system can still suppress the shutdown, if required. However, if
a disconnect implies a "good bye message" sent by the client, then the
disconnect() in either process will trigger that good bye message, making
the connection unusable for the second process as well.
In other words, whether a connection can be used in a forked child, will
almost definitely vary between database drivers and even versions. I do not
know what's specifically changed in 2.9002, but I would assume that you
recompiled the driver, because other things (for example the MySQL client
library) have changed as well on your systems. If so, I would rather see you
querying on the MySQL mailing list first, whether fork() is indeed to work
as you are expecting or not.