Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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:


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, 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

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2022-01-19 16:03 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.