Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Forking and DBI

by tadman (Prior)
on Dec 12, 2002 at 22:14 UTC ( [id://219444]=note: print w/replies, xml ) Need Help??

in reply to forking and dbi

What you might consider doing is making sure that you aren't forking with any database handles open. Shut them all down, fork, and bring them back as required. For example:
my $dbh = DBI->connect(...); $dbh->do(...); $dbh->disconnect(); foreach (...) { ... fork ... } $dbh = DBI->connect(...); $dbh->do(...); $dbh->disconnect();
This would look a lot better if you organized things into functions.

I think what is occuring is that the forked scripts are trying to close out the DBI connection that they inherit from the parent process. Since you can't close them more than once, you're in trouble just having them around at all when forking.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-07-16 20:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.