Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: DBI handler after perfoming fork?

by jasonk (Parson)
on Apr 12, 2008 at 02:35 UTC ( [id://679924]=note: print w/replies, xml ) Need Help??


in reply to DBI handler after perfoming fork?

Trying to share the database handle between two processes like you are doing is just asking for trouble. The best solution would be to connect to the database after the fork, or at least have the child process reconnect to the database after the fork.

You also need to read up on what happens when the process forks, because with the example code you have posted, the next step after the fork is that both the parent and child process are going to attempt to drop the 'foo' table, and then they are both going to call waitpid, and then both attempt to disconnect from the database.


www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re^2: DBI handler after perfoming fork?
by AV-2 (Novice) on Apr 12, 2008 at 02:42 UTC
    I see. I will make it make a new connection to the database then. I really would have preferred not to do so, but oh well. And yeah, I wrote that code kinda too fast and forgot to add the exit for the child.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://679924]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found