http://www.perlmonks.org?node_id=1026271


in reply to Re^3: Parallel::ForkManager memory mixup?
in thread [solved] Parallel::ForkManager memory mixup?

So I woke up this morning and tried this kludge:

$temp = $mech->uri; (undef, $uri) = split (/(\?.*)/, $temp);
I next concatenate session ID in $uri with $url:
$url .= $uri;

Now when I $mech->get($url); etc. and follow with $html = $mech->content; etc. my temporary HTML has proper snippet per fork child!

At Corion's request I did some more debugging, and with FireBug plugin I found this to be an edge case. When a site issues a default, non-random session ID on loading a page, and then links to itself without passing a real session ID... the result is each fork that goes to work on the same offending URL gets jumbled on the next $mech->get($url);

I'm going to mark this solved since each fork was getting the same default fake session ID, and my kludge should be adaptable to any site doing this. With the obvious caveat being you'll need to $mech->get() something that issues you a valid session ID prior to the kludge!