Bug 60668 - Sub optimal regular expressions makes JMeter freeze (catastrophic backtracking regex)
Summary: Sub optimal regular expressions makes JMeter freeze (catastrophic backtrackin...
Status: NEEDINFO
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.9
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-31 04:53 UTC by chamath
Modified: 2017-03-18 13:03 UTC (History)
1 user (show)



Attachments
RegExp that got stuck. (88.74 KB, image/png)
2017-01-31 04:53 UTC, chamath
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chamath 2017-01-31 04:53:51 UTC
Created attachment 34695 [details]
RegExp that got stuck.

Every time I provide a invalid symbol to a regExp Tester, jmeter tool gets stuck and I will have to close the application and start the recording from the beginning.

attached is a screen shot of the invalid RegExp that got stuck.
Comment 1 Philippe Mouawad 2017-02-01 19:39:44 UTC
Hello,
Could you provide the HTML code (as a text file) that is shown in screenshot and the regexp as text (not image) ?

Thank you
Comment 2 Felix Schumacher 2017-02-01 20:31:49 UTC
The used regex is badly composed and will take a long time on moderately long inputs.

The important pieces here are, that the matching is done in the awt thread and thus blocking the GUI. Secondly Java has no standard way to interrupt regex matches.

On
http://stackoverflow.com/questions/910740/cancelling-a-long-running-regex-match
Is a nice wrapper for charsequence, which in combination with a thread can be used to make the matching interruptible.

I think I can produce a patch, but it will probably take a few days.
Comment 3 Philippe Mouawad 2017-02-01 20:44:30 UTC
(In reply to Felix Schumacher from comment #2)
> The used regex is badly composed and will take a long time on moderately
> long inputs.
> 
> The important pieces here are, that the matching is done in the awt thread
> and thus blocking the GUI. Secondly Java has no standard way to interrupt
> regex matches.
> 
> On
> http://stackoverflow.com/questions/910740/cancelling-a-long-running-regex-
> match
> Is a nice wrapper for charsequence, which in combination with a thread can
> be used to make the matching interruptible.
> 
> I think I can produce a patch, but it will probably take a few days.

Hi Felix,
Do you think it's worth the work ?

Badly built Regex can lead to catastrophic backtracking that would kill performance of Load Test anyway.

Regards
Comment 4 Felix Schumacher 2017-02-01 20:55:47 UTC
The use case is about testing a regex in the GUI. Not about using it in the tests.

It would probably help to indicate, that a regex takes too long, even when used in the GUI.

But I think this is more a minor bug.