[CDBI] Bizarre problem,semi-reproducable

Dylan Vanderhoof DylanV at semaphore.com
Wed Jan 18 06:07:40 GMT 2006


Fixed some superfluous '%' characters in Class::DBI::Sweet which let me load it into the debugger.

The problem appears to be timing based, since it never fails on the first pass, and if I put a watch breakpoint on the array (w join ":", at vnames), and then continue every time that hits, the problem never manifests itself.  

Anybody know of a way to watch a variable and not have it break?  Instead log to a file or something?  

-Dylan

-----Original Message-----
From: Dylan Vanderhoof 
Sent: Tuesday, January 17, 2006 6:57 PM
To: Matt S Trout
Cc: classdbi at svr02.digitalcraftsmen.net
Subject: RE: [CDBI] Bizarre problem,semi-reproducable


Running it within the debugger throws the following exception (with or without the breakpoint set):

Caught exception "Bizarre copy of HASH in leave at /usr/lib/perl5/site_perl/5.8.6/Class/DBI/Sweet.pm line 309, <DATA> line 1."


(In case it isn't obvious, this is the first time I've needed to use either SQL abstraction classes, or Catalyst, so debugging is confounding me a bit)

-Dylan

-----Original Message-----
From: Matt S Trout [mailto:dbix-class at trout.me.uk]
Sent: Tuesday, January 17, 2006 6:30 PM
To: Dylan Vanderhoof
Cc: classdbi at svr02.digitalcraftsmen.net
Subject: Re: [CDBI] Bizarre problem,semi-reproducable


On Tue, Jan 17, 2006 at 06:12:41PM -0800, Dylan Vanderhoof wrote:
> Hello all,
> 	I'm not sure the best way to describe this issue, but I'll do what I can.  I don't know if this is a problem with Class-DBI, or Catalyst, or something else, but I'm wondering if anybody has seen anything resembling this at all.
> 
> The very short summary: I'm retrieving some values from a Class::DBI object (via a couple lookup tables as well), and pushing it in a string with some static text into two different arrays.  This process is then repeated n number of times.  On a later iteration, during one of the lookup instructions, the text in one of the already populated arrays is changed.  (A couple characters are missing, specifically).  Its more or less the same characters every time.  (About 3 different places I've seen it, but its pretty consistant)  It does not happen every time this is run, maybe 1 in 4 times.  There are no errors, just missing text.  Its not a thread issue or anything like that, as I've tried it with apache in single-thread mode and nothing else accessing the DB and it still shows this issue.
> 
> Below is a debug log of what's happening:
> 
> [Tue Jan 17 17:58:01 2006] [catalyst] [debug] Pre-dbi defs:
> DEF:ifOutDiscards=/srv/torrus/collector_snr/2/2/15.2.2.fakedomain.com_Fa9_17_if-mib.rrd:ifOutDiscards:AVERAGE
> [Tue Jan 17 17:58:01 2006] [catalyst] [debug] Post-dbi defs:
> DEF:ifOutDiscards=/srv/torrus/collector_snr/2/2/15.2.2.fakedomain.com_Fa9_17_if-mib.rrd:ifOutDiscards:AVERAGE
> [Tue Jan 17 17:58:01 2006] [catalyst] [debug] Post-path defs:
> DEF:ifOutDiscards=/srv/torrus/collector_snr/2/2.2.fakedomain.com_Fa9_17_if-mib.rrd:ifOutDiscards:AVERAGE
> [Tue Jan 17 17:58:01 2006] [catalyst] [debug] Pre-push defs:
> DEF:ifOutDiscards=/srv/torrus/collector_snr/2/2.2.fakedomain.com_Fa9_17_if-mib.rrd:ifOutDiscards:AVERAGE
> 
> This is the second iteration through the loop.  The data being called "defs" here is from the first iteration.  You can see in what I'm calling the post-path line, the characters "2/15" were pulled from the string.
> 
> Below is the code that's causing this, with debug messages.
> 
>    my @vnames;
>     my @lines;
> 
>     foreach my $graph (@graphs)
>     {
>         # Spin through the graphs and put together the last few arguments for the RRDs::graph function
> 
>         $c->log->debug("Pre-dbi defs:\n at vnames");
> 
>         my $rra = NetResponse::Model::CDBI::Rras->retrieve( $graph ) || die "Unable to retrieve rra";
>         $c->log->debug("Post-dbi defs:\n at vnames");

          $DB::single = 1; # and load your app under the perl debugger

>         my $rrd_path = $rra->rrd_path_id->rrd_path;
>         $c->log->debug("Post-path defs:\n at vnames");
>         my $rra_cf = $rra->cf;
>         my $rra_name = $rra->rra_name_id->name;
> 
>         $c->log->debug("Pre-push defs:\n at vnames");
>         push(@vnames,"DEF:$rra_name=$rrd_path:$rra_name:$rra_cf");
>         push(@lines,"LINE1:$rra_name\#00FF00:$rra_name\\c");
>         $c->log->debug("DEF:$rra_name=$rrd_path:$rra_name:$rra_cf");
>         $c->log->debug("defs:\n at vnames");
>     }
> 
> 
> 
> You can see from the debugging that the change to the array is happening during the line "my $rrd_path = $rra->rrd_path_id->rrd_path;"
> $rra is an instance of NetResponse::Model::CDBI::Rras, which has a base class of NetResponse::Model::CDBI, which has a base class of Catalyst::Model::CDBI and uses Catalyst::Model::CDBI::Sweet.
> 
> Has anybody seen anything like this before, or have even the slightest idea what might be going on?  I have tried to troubleshoot this in every way I know how, but I am at a total loss, since during the line where the array is changed, the array should not even be being accessed.
> 
> Thanks,
> Dylan
> 
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
ClassDBI mailing list
ClassDBI at lists.digitalcraftsmen.net
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi




More information about the ClassDBI mailing list