Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Forking Problem: Attempt to free unreferenced scalar

by srlbharu (Acolyte)
on Mar 07, 2013 at 18:02 UTC ( #1022284=perlquestion: print w/replies, xml ) Need Help??
srlbharu has asked for the wisdom of the Perl Monks concerning the following question:

I am getting the below error only when I try to create child process using fork in the code mentioned below

foreach $cmd(@commands) { if($cmd =~ /CGDCONT/i){ unless (fork) { eval $cmd; if ($@) { print "When executing: $cmd\nFollowing error occured:$@\ +n"; } exit; } } else{ eval $cmd; if ($@) { print "When executing: $cmd\nFollowing error occured: $@\n +"; } } }

Error msg when I run the above code:

Engine::_Execute(..\..\perl\modules/ 122: unless (fork) { DB<1> s Bizarre SvTYPE [37] at ..\..\perl\modules/ line 122. Engine::_Execute(C:/Perl/lib/ 97: { local $@; require Carp::Heavy; } # XXX fix require to not clea +r $@?

It means there are some localized scalar variables are trying to restore in a child process hence throwing error

"Attempt to free unreferenced scalar"

There is some modules where is used. I replaced all the places of carp with warn and tried but no luck still it is showing the same. Please let me know how to debug this issue.

Replies are listed 'Best First'.
Re: Forking Problem: Attempt to free unreferenced scalar
by Anonymous Monk on Mar 07, 2013 at 19:36 UTC

    Please let me know how to debug this issue.

    create a small self contained example that reproduces the error and post it, ie copy Engine::_Execute and whatever else code you're using, and start deleting lines until the error disappears -- either you'll figure out how to fix it, or you'll have something we can debug

    try upgrading perl or whatever modules you're using

      Thanks a lot.. I will try this way and update the status. Might take a bit more time to me :-(

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1022284]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2017-08-19 19:27 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (312 votes). Check out past polls.