SID-00098: FilterPlugin - Can a bad RE cause endless loop?
| Status: |
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
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.