Daniel DeLorme wrote: > It's commonly known that database connections do not play well with > Process.fork; I thought that using at_exit{exit!} was the correct way > to solve this problem, but it appears imperfect. Take this pseudo-code: > > 1 db1 = mysql_connect() > 2 Process.fork do > 3 at_exit{exit!} > 4 db2 = mysql_connect() > 5 db2.query(...) > 6 end > 7 Process.wait > 8 db1.query(...) As long as the child process doesn't touch the db1 socket, nothing should happen. So I guess what's happening is that the mysql connection object has a finalizer, and that finalizer is sending something down the socket when the child terminates, which is of course the same socket that the parent process has. The traditional Unix way of handling this is immediately to close the db1 socket in the child (without sending any data down it, of course). I don't know if the MySQL API exposes the underlying socket in a convenient way: e.g. db1.socket.close -- Posted via http://www.ruby-forum.com/.