Tags:
create new tag
view all tags

SID-00098: FilterPlugin - Can a bad RE cause endless loop?

Status: Answered Answered TWiki version: 4.2.3 Perl version: 5.008008 (linux)
Category: FilterPlugin Server OS: Linux 2.6.15.7 (i486-linux-gnu-thread-multi) Last update: 17 years ago

Some RE work fine others cause endless loops. It doesn't seem possible, but it's forced me to restart apache several times.

  • the 1st line works, the 2nd line causes an infinte loop - eats up to 100% of the cpu with the view process
%EXTRACT{topic="%TOPIC%" expand="off" limit="100" pattern="[\n\r]+(\|[^\n\r]*Due Diligence & issue resolution.*?)[\n\r]+" format="$1 $n"}%

%EXTRACT{topic="%TOPIC%" expand="off" limit="100" pattern="[\n\r]+([^\n\r]*Due Diligence & issue resolution.*?)[\n\r]+" format="$1 $n"}%

-- BurtWelsh - 13 Feb 2009

Discussion and Answer

I've had other cases where each view would grab 25% of the capacity on a quad-processor machine: one click to a processor! It happens.

> Can a bad RE cause endless loop?

Not the RE per se, but the perl in the plugin that is parsing it. In other words, you probably have discovered a bug to report.

-- SeanCMorgan - 13 Feb 2009

Well I'm just the fastest bug finder in the world then because the first 5 REs I wrote all caused endless loops. By the way - in the above examples isn't the 1st RE just a subset of the 2nd RE? There were some RE that were even simpler that caused endless loops.

  • 1st RE extracts a line starting with "|" and containing "Due Diligence & issue resolution"
  • 2nd RE extracts a line containing "Due Diligence & issue resolution"

Anybody know of another way to extract an arbitrary number of occurrences of a string in a file?

-- BurtWelsh - 13 Feb 2009

The bug appears to be that FilterPlugin doesn't like .* (or at least, it works when i don't use that):

1st case:
%EXTRACT{topic="%TOPIC%" expand="off" limit="100"
  pattern="^\| Due Diligence & issue resolution([^\n]*)"
  format="$1 $n"
}%

2nd case:
%EXTRACT{topic="%TOPIC%" expand="off" limit="100" 
   pattern="Due Diligence & issue resolution([^\n]*)"
   format="$1 $n"
}%

FilterPlugin works on each line of %TOPIC%, so you don't need all that [\n\r] stuff in your original EXTRACTs (I removed them for legibility). I used [^\n]* simply to avoid the string .*

P.S. on my server, your EXTRACTs chewed up RAM instead of CPU. That would seem to indicate recursion run amuck.

-- SeanCMorgan - 17 Feb 2009

Thanks, I didn't realize

  • FilterPlugin works line by line
  • ^ is start of line $ is end of line
I thought that ^ was start of the whole %TOPIC%

-- BurtWelsh - 20 Feb 2009

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title FilterPlugin - Can a bad RE cause endless loop?
SupportCategory FilterPlugin
TWiki version 4.2.3
Server OS Linux 2.6.15.7 (i486-linux-gnu-thread-multi)
Web server Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g
Perl version 5.008008 (linux)
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2009-02-20 - BurtWelsh
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.