Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Note: See also bug #83364 (RESOLVED) filed towards perl core.

I have a perl daemon that in principle (unless stopped or restarted) will run forever. From time to time it crashes inexplicably after having emitted errors like shown below:

Variable "$self" will not stay shared at (eval 999973501) line 15. Variable "$self" will not stay shared at (eval 999975201) line 15. Global symbol "$i" requires explicit package name at (eval 999977609) +line 42.
I notice the eval counter (if such a thing exists) in each case seems to be very close to 10**9. Is there a hard coded limit somewhere in the perl interpreter that might explain this behavior, or should I look in the mirror for root causes?

Update 1: Similar symptoms previously described here.

Update 2: I manage to reproduce the problem using a slightly altered verison of code from this node (thanks Jeppe). Note that the problem only manifests after running almost 4 hours on my Intel(R) Core(TM)2 Quad CPU Q9450 @2.66GHz, (perl v5.10.0, x86_64-linux, Linux 2.6.18) :

use strict; use warnings; use Inline C => q{ int evalseq() { return PL_evalseq; }}; use Log::Log4perl; use Log::Dispatch::FileRotate; my $conf = q( log4perl.category.Script = DEBUG, ScriptFileRotateAppender log4perl.appender.ScriptFileRotateAppender = Log::Dispatch +::FileRotate log4perl.appender.ScriptFileRotateAppender.filename = evalseq.log log4perl.appender.ScriptFileRotateAppender.mode = append log4perl.appender.ScriptFileRotateAppender.size = 10000000 log4perl.appender.ScriptFileRotateAppender.max = 50 log4perl.appender.ScriptFileRotateAppender.layout = PatternLayout log4perl.appender.ScriptFileRotateAppender.layout.ConversionPattern= +[%p] %d %m%n ); Log::Log4perl::init( \$conf ); my $log = Log::Log4perl::->get_logger(q(Script)); my $count = 0; until ($@) { $count++; eval 'my $abc = 1; $abc++; '; unless ($count % 1e5) { $log->info( "count=$count evalseq=" . evalseq() ); } } $log->error( $count .' ' .$@ ); __END__ $ perl -v This is perl, v5.10.0 built for x86_64-linux $ uname -a Linux desktop 2.6.18-194.8.1.el5 #1 SMP Thu Jul 1 19:04:48 EDT 2010 x8 +6_64 x86_64 x86_64 GNU/Linux
The output:
[INFO] 2011/01/31 10:03:54 count=100000 evalseq=100026 [INFO] 2011/01/31 10:03:55 count=200000 evalseq=200027 [INFO] 2011/01/31 10:03:56 count=300000 evalseq=300028 [INFO] 2011/01/31 10:03:58 count=400000 evalseq=400029 [INFO] 2011/01/31 10:03:59 count=500000 evalseq=500030 ... [INFO] 2011/01/31 13:45:23 count=1073300000 evalseq=1073310758 [INFO] 2011/01/31 13:45:24 count=1073400000 evalseq=1073410759 [INFO] 2011/01/31 13:45:26 count=1073500000 evalseq=1073510760 [INFO] 2011/01/31 13:45:27 count=1073600000 evalseq=1073610761 [INFO] 2011/01/31 13:45:28 count=1073700000 evalseq=1073710762 [ERROR] 2011/01/31 13:45:29 1073733744 Global symbol "$abc" requires e +xplicit package name at (eval 1073744507) line 1.

Update 3: Reproduced in 7 hours with perl v5.10.1 MSWin32-x86-multi-thread:

use strict; use warnings; use Log::Log4perl; my $conf = q( log4perl.category.Script = DEBUG, ScriptFileRotateAppender, + Screen log4perl.appender.ScriptFileRotateAppender = Log::Log4perl +::Appender::File log4perl.appender.ScriptFileRotateAppender.filename = evalseq.log log4perl.appender.ScriptFileRotateAppender.mode = append log4perl.appender.ScriptFileRotateAppender.size = 10000000 log4perl.appender.ScriptFileRotateAppender.max = 50 log4perl.appender.ScriptFileRotateAppender.layout = PatternLayout log4perl.appender.ScriptFileRotateAppender.layout.ConversionPattern= +[%p] %d %m%n log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = PatternLayout log4perl.appender.Screen.layout.ConversionPattern=[%p] %d %m%n ); Log::Log4perl::init( \$conf ); my $log = Log::Log4perl::->get_logger(q(Script)); my $count = 0; until ($@) { $count++; eval 'my $abc = 1; $abc++; '; unless ($count % 1e5) { $log->info( "count=$count" ); } } $log->error( "count=$count " .$@ ); __END__
Output:
[INFO] 2011/02/01 13:53:09 count=100000 [INFO] 2011/02/01 13:55:12 count=100000 [INFO] 2011/02/01 13:55:14 count=200000 ... [INFO] 2011/02/01 20:49:06 count=1073500000 [INFO] 2011/02/01 20:49:08 count=1073600000 [INFO] 2011/02/01 20:49:11 count=1073700000 [ERROR] 2011/02/01 20:49:12 count=1073740465 Global symbol "$abc" requ +ires explicit package name at (eval 1073740483) line 1.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

In reply to Interpreter eval counter out of bounds by andreas1234567

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found