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

nth eval of same code creates errors

by Anonymous Monk
on Apr 01, 2008 at 11:45 UTC ( [id://677739]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everyone
Here is a head scratcher. I am using log4perl which contains a few eval statements and sometimes see strange activity - the script (which runs as a POE process) exits after a while (clarification, runs perfectly for a while and then exits) with the error:

Global symbol xxxx requires explicit package name at (eval 226185663) line yyyy.

(xxx being an internal log4perl variable but not always the same one)

Thing is that _many_ iterations of evaluating the code have gone by (like 226185663 above) and then the error is thrown. I can only conclude that log4perl is fine and something else is affecting this.

My questions:
1) I know that the number 226185663 is the eval number (i.e. incremented each time an eval is run), but I can't see how it gets so high - that amount of iterations would take months - is there any way to print this number on the console to see if something else increments it
2) Any idea on the problem at hand? I have lots of scripts using log4perl and only this particular one fails (but only after a long running time)

Thanks

Warren

Replies are listed 'Best First'.
Re: nth eval of same code creates errors
by dave_the_m (Monsignor) on Apr 01, 2008 at 16:43 UTC
    If you have the ability to attach a debugger like gdb to the process, then you can look at the value of the PL_evalseq variable (or on a threaded Perl, the value of my_perl->Ievalseq). For example in the following, perl588 and perl588t are unthreaded and threaded versions of perl:
    $ perl588 -e 'eval "1;" for 1..10; sleep 9999' & [1] 8491 $ gdb `which perl588` 8491 ... (gdb) p PL_evalseq $1 = 0xa (gdb) quit $ perl588t -e 'eval "1;" for 1..10; sleep 9999' & [1] 8525 $ gdb `which perl588t` 8525 ... (gdb) bt #0 0x00110402 in __kernel_vsyscall () #1 0x003f2e20 in __nanosleep_nocancel () from /lib/libc.so.6 #2 0x003f2c6f in sleep () from /lib/libc.so.6 #3 0x08133397 in Perl_pp_sleep (my_perl=0x8837008) at pp_sys.c:4589 ... (gdb) frame 3 (gdb) p my_perl->Ievalseq $1 = 0xa (gdb)

    Dave.

      Thanks Dave. I don't have gdb, but that gave me an idea - I'll report my findings back soon.

      Warren
Re: nth eval of same code creates errors
by warrenvw (Initiate) on Apr 01, 2008 at 12:02 UTC
    Doh! Anoymous Monk would be me not logged in...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found