You are here: Foswiki>Tasks Web>Item10694 (05 Jul 2015, GeorgeClark)Edit Attach

Item10694: Complex regular subexpression recursion limit (32766) exceeded in Render.pm.

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: FoswikiRender
Branches: trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Definition lists with embedded colon's in the term result in the message:
 view: Complex regular subexpression recursion limit (32766) exceeded at /var/www/foswiki/trunk/core/lib/Foswiki/Render.pm line 1193.

The following triggers the error:

$ xxxxxxxx::xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx

This can be encountered when defining configure variables, such as: $ $Foswiki::cfg{blah}: some long description

-- GeorgeClark - 01 May 2011

This crash happens much sooner on trunk. This topic and also Extensions/Testing/LogDispatchContrib triggers the crash on trunk, works okay on 1.1.9

-- GeorgeClark - 22 Mar 2014

I was able to reproduce this with a small example as follows:
use warnings;
'   $ :012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567:' =~/((\t|   )+)\$\s(([^:]+|:[^\s]+)+?):\s/;

It's not an error, it's a warning, and it appears to be a perl bug.

-- CrawfordCurrie - 27 Mar 2014

Testing through some perlbrew installations, your example:
  • Works on Perl 5.8.8
  • Fails on >= 5.10.1 including perl-5.10.1 perl-5.12.5 perl-5.14.2 perl-5.14.3 perl-5.16.1 (5.16.3) perl-5.18.1 perl-5.18.2t and perl-5.19.7

So as sites upgrade from 5.8.8, they are going to start encountering issues if they use definition lists. If nothing else, noisy logs.

I found one hit on perlmonks: http://www.perlmonks.org/?displaytype=print;node_id=810857;replies=1

Should we just disable warnings for that regex? It concerns me a bit that we have shipping topics that will trigger warnings, and for sites with ASSERTS enabled, errors. We could also move the definition list parse out of the regex based part of rendering and into the line loop?

-- GeorgeClark - 27 Mar 2014

having looked at the code involved, I can't fathom why it needs to be so complex. I think it can be a lot simpler, which would circumvent the problem.

-- CrawfordCurrie - 03 Apr 2014

This now renders definition lists where none where before.

Example:

      <h3>Title:</h3>

-- MichaelDaum - 04 Apr 2014

Thanks, unit test added and core code fixed.

-- CrawfordCurrie - 04 Apr 2014

 

ItemTemplate edit

Summary Complex regular subexpression recursion limit (32766) exceeded in Render.pm.
ReportedBy GeorgeClark
Codebase 1.1.4, 1.1.3, trunk
SVN Range
AppliesTo Engine
Component FoswikiRender
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:e64043b8e7db distro:92903ddc4dad distro:e36abb0aba4e
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches trunk
trunkCheckins distro:e64043b8e7db distro:92903ddc4dad distro:e36abb0aba4e
Release01x01Checkins
Topic revision: r13 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy