A
Arvin Portlock
In using ExpatXS to parse large batches of XML files
something curious happens. After parsing something close
to 500 files the program crashes with the error:
Can't call method "read" on an undefined value at
/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
XML/SAX/ExpatXS.pm line 155.
Of course I examined the files where the errors occurred
and there is nothing wrong with them. I can do this on any
batch of files and get the same problem--permissions are
always set correctly, the files are confirmed well-formed,
etc.
Sounds like something's leaking.
I reduced my big complex program down to something very
simple which doesn't actually do anything. It still crashes
after (successfully) parsing around 500 files. Can somebody
test this script on a large batch of files, or otherwise tell
me what I'm (or ExpatXS) is doing wrong? Maybe it's a problem
with XML::Filter?
# $Id: ExpatXS.pm,v 1.39 2005/11/10 09:38:31 cvspetr Exp $
This is perl, v5.8.7 built for sun4-solaris-thread-multi
Simple program follows:
use XML::SAX;
use XML::Filter::BufferText;
use File:ath;
use strict 'vars';
my $dir = '/home/xmldocs/lib1';
opendir (DIR, $dir);
my @xmlfiles = grep (/\.xml/, readdir (DIR));
closedir (DIR);
foreach my $file (sort @xmlfiles) {
my $fullpath = "$dir/$file";
print STDERR "$fullpath\n";
my $handler = new MySAXHandler;
my $filter = new XML::Filter::BufferText (Handler => $handler);
my $parser = XML::SAX:arserFactory->parser(Handler => $filter);
$parser->parse_uri($fullpath);
undef $parser;
undef $filter;
undef $handler;
}
package MySAXHandler;
use base qw(XML::SAX::Base);
sub start_element {
}
sub end_element {
}
something curious happens. After parsing something close
to 500 files the program crashes with the error:
Can't call method "read" on an undefined value at
/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
XML/SAX/ExpatXS.pm line 155.
Of course I examined the files where the errors occurred
and there is nothing wrong with them. I can do this on any
batch of files and get the same problem--permissions are
always set correctly, the files are confirmed well-formed,
etc.
Sounds like something's leaking.
I reduced my big complex program down to something very
simple which doesn't actually do anything. It still crashes
after (successfully) parsing around 500 files. Can somebody
test this script on a large batch of files, or otherwise tell
me what I'm (or ExpatXS) is doing wrong? Maybe it's a problem
with XML::Filter?
# $Id: ExpatXS.pm,v 1.39 2005/11/10 09:38:31 cvspetr Exp $
This is perl, v5.8.7 built for sun4-solaris-thread-multi
Simple program follows:
use XML::SAX;
use XML::Filter::BufferText;
use File:ath;
use strict 'vars';
my $dir = '/home/xmldocs/lib1';
opendir (DIR, $dir);
my @xmlfiles = grep (/\.xml/, readdir (DIR));
closedir (DIR);
foreach my $file (sort @xmlfiles) {
my $fullpath = "$dir/$file";
print STDERR "$fullpath\n";
my $handler = new MySAXHandler;
my $filter = new XML::Filter::BufferText (Handler => $handler);
my $parser = XML::SAX:arserFactory->parser(Handler => $filter);
$parser->parse_uri($fullpath);
undef $parser;
undef $filter;
undef $handler;
}
package MySAXHandler;
use base qw(XML::SAX::Base);
sub start_element {
}
sub end_element {
}