Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Embperl/Apache::Session and forking

by devnul (Monk)
on Jul 21, 2004 at 20:10 UTC ( #376367=perlquestion: print w/ replies, xml ) Need Help??
devnul has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

So I've got this Embperl script (running via cgi, not mod_perl) which needs to fork a process.... The problem is sometimes this forked process core dumps (usually within Storable.pm, which is what we've got Apache::Session to use)... I'd sure like to know why it's core dumping, but I just can't figure it out (it happens very rarely and I can't find anything which reliably reproduces the problem)...

It occurs to me that it is desirable to not have the child process trying to write out the session during perl_destroy (which is what the DESTROY method in the Apache::Session object attempts to do)... Any ideas on what I might be able to do here?... The child *does* need access to what is saved in the session object, it should just not try to be saving it, in my opinion....

- Greg

Comment on Embperl/Apache::Session and forking
Re: Embperl/Apache::Session and forking
by perrin (Chancellor) on Jul 21, 2004 at 20:58 UTC
    Unless you modify the session data, it will not try to save it.
      Right.. But at the point the child is forked it could be in a state where it "thinks it outta be saved", so then both the parent and child will attempt to do so during perl_destruct, right?....

      If the parent takes longer to finish than the child(and the call succeeds) this would indicate the session would now contain old data from the child....

      - Greg
        There are various things you could do. You could copy the session data into a hash and close the session before forking. You could mark the session as unchanged so it doesn't save. You'd probably need to release locks if you are using locking. You could also just close the session before you fork and re-open it afterward, but I'd suggest turning off the session locking if you do that.

Log In?
Username:
Password:

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

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

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








    Results (260 votes), past polls