Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Deep recursion error using LibXML

by ikegami (Patriarch)
on Dec 31, 2010 at 04:44 UTC ( [id://879902]=note: print w/replies, xml ) Need Help??


in reply to Deep recursion error using LibXML

Deep recursion is a problematic warning as perfectly legitimate code can emit it, and that code is not always under your control. That's the case here.

In 5.12, 100 levels of recursion triggers the warning, but I think the count that triggers the warning was increased at some point. This could have been after the rather old 5.8.8 you are using. Upgrading (perhaps even to 5.8.9) might solve the issue.

Alternative, you could use a warning handler to suppress that warning.

local $SIG{__WARN__} = sub { return if $_[0] =~ /^Deep recursion /; local $\; print STDERR $_[0]; };

or

my $prev_handler = $SIG{__WARN__}; local $SIG{__WARN__} = sub { return if $_[0] =~ /^Deep recursion /; local $SIG{__WARN__} = $prev_handler; warn($_[0]); };

Update: What changed was that a limit that was hardcoded became a define (PERL_SUB_DEPTH_WARN) you could change when you build perl.

Replies are listed 'Best First'.
Re^2: Deep recursion error using LibXML
by mertserger (Curate) on Dec 31, 2010 at 11:11 UTC
    I have done some more work on this. I can unload entries from the dictionary database and run them through the perl scripts outside of the main editorial system. In that way, I can cut out bits of the entry to see what Perl is objecting to.

    I have discovered that there is one element which causes this warning. Removing the element altogther allows the DTD parser to work and it then finds three DTD errors in the rest of the entry. So that answers my question about whether I could just disable the warning (answer: no).

    However the weird thing is that when I experiment with removing some of the content of the problematic element I can reach a point where I lose the "deep recursion" warning but I don't get the other DTD errors either. This is a bit puzzling.

    The problem with the element in question seems to be that it actually has a very flat structure: lots of sibling elements all children of this one element with no deeper structure. The line in Error.pm appears to be turning previous elements within the tested element into strings so I can see how the last element in this flat structure could end up calling this very recursively. However as someone said above the data is what it is.

    The only other options I can see would be to change the recursion limit itself but looking at other discussions of recursion in Perl in PM, it doesn't look simple to change. In any case Perl was compiled by root and I don't have root level privileges on this system so I'd need to ask the sysadmin to do this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://879902]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-03-29 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found