On Apr 25, 2008, at 1:40 AM, Steve Kemp wrote:

 Looking on perlmonks there are reports of people seeing random
problems if they fork() and use DBI without special care.


Yes, if you are not careful then you can end up opening a database connection in the parent process and then use it from multiple processes.

With low concurrency and few and fast queries your odds are decent that it works a lot of the time, but the risk is that you send a query in one process and end up reading the result from another!

It happened to me a few weeks ago[1] -- in development I didn't see the error, but in production it went kaboom pretty fast. http://xrl.us/bjs3u (Link to getsatisfaction.com)


 - ask

[1] And I've been doing variations of this since ~97 -- experience helps, but I'm obviously still perfectly capable of shooting myself in the foot!

--
http://develooper.com/ - http://askask.com/


Reply via email to