Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 56671
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: scop [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.70
Fixed in: (no value)



Subject: $err = $err->_prev() loop never returns false
In some cases, calling "$err = $err->_prev()" in a loop never returns a false value but starts to cycle through the same errors over and over again. The script below and the JBR-ALLENtrees.htm attachment from http://lists.w3.org/Archives/Public/www-validator/2010Apr/0040.html demonstrates it, it ends up in an apparently infinite loop. If I remove the eval from the script (which isn't a good thing if I want all errors reported I gather from the docs), it completes normally, reporting issues only once. ------ use XML::LibXML; my $parser = XML::LibXML->new(); $parser->validation(0); $parser->load_ext_dtd(0); eval { $parser->parse_file("JBR-ALLENtrees.htm"); }; my $err = $@; while ($err) { print $err, "\n"; $err = $err->_prev(); }
On further investigation, it seems that it could actually sometime return false. But looping through the (large number of entity related) errors is so slow that the effect is pretty much the same as if it didn't. Enabling external entity fetching and entity expansion works around the problem, but that might not be a trivial/practical option in my use case even with local fairly well populated catalogs (W3C markup validator, could cause significant entity retrieval load, just for well-formedness check for which we use XML-LibXML for).
On Mon Apr 19 16:52:19 2010, SCOP wrote: Show quoted text
> On further investigation, it seems that it could actually sometime > return false. But looping through the (large number of entity > related) errors is so slow that the effect is pretty much the same > as if it didn't.
Having looked into this somewhat more, it is now my understanding that this is not limited to entity related errors; the slowness occurs whenever there are lots of errors, seemingly no matter what the errors are.
Thanks for the report. Apparently, the problem was that the previous error chain was roughly 2012 hops long and consumed an obscene amount of RAM, which was a big problem. I've now set a limit to how much it can go deep. It's fixed in the repository: https://bitbucket.org/shlomif/perl-xml-libxml and will be uploaded to CPAN soon. Regards, -- Shlomi Fish