[Pdx-pm] Strange Random coredumps

Mark Hartley mark at drapple.com
Thu Dec 19 14:35:09 CST 2002


I am having a very frustrating problem with a few Perl apps
I've written randomly dumping core, and I'm hoping someone can
point me in a direction to find the cause.

A little background as to what I'm doing:
I have a whole bunch of applications that I've written which run
as a CGI under Apache (1.3.26) on a FreeBSD (4.6.2-RELEASE-p4) machine.
There are actually 3 of these machines, one of which is running SSL.
All 3 machines are using Perl 5.005_03.

The applications are talking to a MS SQL server 2000 database (not by
my choice).  I am using DBI:Sybase drivers to talk to the db.  I know
that I could use ODBC drivers as well, but right now I'm using the
Sybase ones.


OK, now to the problem:

These applications get a fair amount of traffic each day (something along
the lines of 32,000 hits per day).  One specific app takes about 25% of
that.  Now, the app runs about 8000 times per day, and it will randomly
dump core anywhere from 0 up to 100 times per day, leaving no information in 
Apache's error log as to what happened.  The 0 days are good, but the other days 
I end up taking heat from the client.  I've tried adding debugging code into the
scripts to try and find where it dies, and I've had a reasonable amount of 
success with this method, but the code is correct.  The places where it is dying
don't seem to to form any kind of a pattern. Sometimes it dies trying to read 
from the db, other times it will die while trying to generate some output. But
I know the code is correct and works.  I've gone over it a zillion times, and it 
runs perfectly over 7500 times per day. If I try to run it through the perl 
debugger by hand, everything seems to work just fine, but with the fact that it
runs fine 98% of the time, that doesn't surprise me.

This is happening with several of the scripts.  I was just using this one as 
an example.  I've found I can significantly reduce the number of times the 
applications die if I simply put a:

print STDERR "foo\n";

in the script in a few different places.  It makes no sense to me why adding
a few of those will cause a script to be significanlty more stable if I add
those.  I realize I can just leave them in, but it feels like a bandaid, and
it doesn't eliminate the problem, it just reduces it.


Now some of these Perl scripts are reasonably large (the one I mention above
is 72kb with nearly 2000 lines), but the coredumps also happen on scripts with
only a couple hundred lines of code.


Does anyone have any advice or anything they can help me figure out with regards
to this.


Mark.




More information about the Pdx-pm-list mailing list