[Chicago-talk] core dump using DBI

Michael Potter michael at potter.name
Mon Jul 14 17:10:57 PDT 2008


Monks,

I am core dumping in this fragment of code:
----------------------------------------------
        foreach my $TableName (@TableNames)
         {
            my $SelectSub = qq{
               SELECT * FROM
                     $TableName
                  WHERE ARTKEY1 = ?
            };

            my $sth_ssa = $DbHandle->prepare($SelectSub);
            $sth_ssa->execute($artkeyA);
            $Counter = 0;
            while (my $hsa = $sth_ssa->fetchrow_hashref())
            {
               $Counter++;
               delete $hsa->{ARTKEY1};
               $hsa->{TABLENAME} = $TableName;
               push @aa, $hsa;
            }
            $sth_ssa->finish();

            my $sth_ssb = $DbHandle->prepare($SelectSub);
            $sth_ssb->execute($artkeyB);
            $Counter = 0;
            while (my $hsb = $sth_ssb->fetchrow_hashref())
            {
               $Counter++;
               delete $hsb->{ARTKEY1};
               $hsb->{TABLENAME} = $TableName;
               push @ab, $hsb;
            }
            $sth_ssb->finish();
         }
-------------------------------------

I pulled up the core dump in the debugger and it is failing with this error:
malloc_common.extend_brk(internal error: assertion failed at line 3626
in file frame.c

There is another loop that surrounds this loop and runs about 27,000
times.  The loop you see runs about 20 times for each of the 27,000.
It fails at about 6200.  I shifted the data to confirm that the actual
data is not the problem.

I am on AIX/DB2/Perl 5.8.5.

I know it would be ideal if I could create a sample application that
would reproduce this problem, but with all the data required to
reproduce the problem this is not practical.  I also suspect the
problem is in DBI and way over my head to debug.

My next action will be to move this loop to it's own script so that
memory will be cleaned up by the termination of the script, then I
will execute that script 27,000 times.

Any better ideas?

-- 
Michael Potter


More information about the Chicago-talk mailing list