Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl script dies with The instruction at "0x28089a3d" referenced memor

Status
Not open for further replies.

svar

Programmer
Joined
Aug 12, 2001
Messages
350
Location
GR
This is a problem seen on Activestate 5.008007. This is a script that uses DBI and an Oracle database to run some queries, store the results in a number of hash datastructures
and create some reports via spreadsheet:writeExcel
The problems started when I added hashes to keep track of averages and standard deviations. Specifically, I started getting crashes with the message:

perl script dies with The instruction at "0x28089a3d" referenced memory at "0x0000004". The memory could not be "written".
The crash occured if one trusts the print messages somewhere
in this segment:
if(exists $ravgswkday->{$el}->{$dateval}->{$quarter}){
$ravgswkday->{$el}->{$dateval}->{$quarter}->{'OCC'} += $occ;
$ravgswkday->{$el}->{$dateval}->{$quarter}->{'ASR'} += $asr; $ravgswkday->{$el}->{$dateval}->{$quarter}->{'N'}++;}
else{$ravgswkday->{$el}->{$dateval}->{$quarter}->{'ASR'} = $asr; $ravgswkday->{$el}->{$dateval}->{$quarter}->{'N'}=1;
$ravgswkday->{$el}->{$dateval}->{$quarter}->{'OCC'} = $occ; }
#print "after occ\n";
if(exists $rstdswkday->{$el}->{$dateval}->{$quarter}){
print "in if exists\n";
$rstdswkday->{$el}->{$dateval}->{$quarter}->{'ASR'} += ($asr*$asr);
#print "asr added\n";
$rstdswkday->{$el}->{$dateval}->{$quarter}->{'OCC'} += ($occ*$occ);
#print "occ added\n";
}else{#print "in elase rstdswkday\n";
$rstdswkday->{$el}->{$dateval}->{$quarter}->{'ASR'} = $asr*$asr; print "else added asr\n";
$rstdswkday->{$el}->{$dateval}->{$quarter}->{'OCC'} = $occ*$occ;print "else added occ\n";}
print "after rstdwkday of $el $dateval $quarter \n";


which occurs once for each row of the sql query






At some point I changed the hash structure(used to be per day, now per weekday/weekend) and I got further to

print "finished rstatdata/rstatdetailed query\n";
&storehash("stdswkdaydatahash",$rstdswkday);
&storehash("avgswkdaydatahash",$ravgswkday );
# now gets avgs and stds (daily avgs or 15 minute avgs?)


print "finished all stdwork\n";
I never see the last print on the screen, but the two hashes are apparently created

storehash is simply

sub storehash{
############## STORE DATASTRUCTURE ##################
#Store routehash data structure in a file
my $filename=shift; my $rhash=shift;
open(OUTHANDLE,">$filename") or die "cannot open $filename for writing\n";
eval{store ($rhash,"$filename");};
die "error writing to file: $@" if $@; close(OUTHANDLE);
}

I really do not know how to debug this any further. It looks like an Activestate problem. According to my estimates
this is NOT a memory issue, though the fact that by shrinking the size of the hash I was able to delay the crash may seem so, but on the other hand, I would expect an out of memory message instead of the message I am getting!

Unfortunately the script is long to post here and requires SQL queries to an unavailable database.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top