Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Fork-safe DBI handles via ChildHandles and InactiveDestroy

by etcshadow (Priest)
on Jun 07, 2007 at 05:08 UTC ( #619736=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Fork-safe DBI handles via ChildHandles and InactiveDestroy
in thread Fork-safe DBI handles via ChildHandles and InactiveDestroy

To be really careful, a program which forks should avoid letting the kids inherit such connections.

Ideally, that's exactly what I'd do. Unfortunately, I'm not aware that any such method really exists. If there is such a way, I'd love to learn about it. For anything that is some sort of file handle or socket (including all my examples above), the only way (that I know of) that you can "avoid letting the kids inherit" it is to close it before forking. Of course, that fails to meet the broader goal of isolating it from unintended side-effect. (Closing it is a pretty big side-effect.)

By the way, if this sounds argumentative, it's not intended. I'm aiming for "inquisitive". (It can be very hard to accurately convey tone in a text-only medium.) I'd really like to learn more about what facilities there are for making this kind of mess easier (if any exist). I can't tell if what you're saying is "Too bad this sort of necessary when dealing with sockets and handles and forks" or if what you're saying is "Geez, I can't believe you don't know about MagicallyAwesomeFork that allows you to selectively not copy portions of your process in the fork." Although I'm confused as to how that could possibly be accomplished, I'd definitely like to learn.

------------ :Wq Not an editor command: Wq


Comment on Re^4: Fork-safe DBI handles via ChildHandles and InactiveDestroy
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (15)
As of 2014-07-10 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (212 votes), past polls