Bug 64493 - [find/replace] Regex search should be cancellable
Summary: [find/replace] Regex search should be cancellable
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 107368 283904 440518 (view as bug list)
Depends on:
Blocks: 119493
  Show dependency tree
 
Reported: 2004-05-28 01:06 EDT by adrian CLA
Modified: 2019-08-08 15:20 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adrian CLA 2004-05-28 01:06:15 EDT
Open a relatively small file with Text editor.  Select Ctrl+F, check "Regular
expressions" checkbox, enter this in the "Find" field:

(.*)*c

It will take a long time to complete the search, the entire system appears hung
(with very high CPU utilization) - the larger the file, the longer it will take
to complete.

There should be a way for the user to interrupt such a search.
Comment 1 Dani Megert CLA 2004-05-28 10:34:12 EDT
closing this one even if older (other PR has more info)

*** This bug has been marked as a duplicate of 64531 ***
Comment 2 Dani Megert CLA 2004-05-28 10:51:40 EDT
not a dup
Comment 3 Alan Gibson CLA 2004-12-24 20:17:29 EST
I am experiencing this bug when doing any regular expression search. 

System:
Win 2k SP 2
JDK: 1.5
Version: 3.1.0 Build id: 200411050810
Comment 4 Markus Keller CLA 2005-03-03 10:04:47 EST
The regular expression (.*)*c is inherently inefficient due to nested repetition
operators and there's nothing we can do about that. Changing title from
"Inneficient regex search" to "Regex search should be cancellable".
Comment 5 Markus Keller CLA 2005-06-27 11:32:39 EDT
This bug can be quite annoying. I entered such an inefficient regex by accident
and found no way to stop the search.

Since we use the non-cancellable java.util.regex.Matcher#find() for doing the
regex search, I see no way to make this cancellable except this one:
- move the regex search into a new thread
- do the search in a job (as the file search already does)
- when the search job is cancelled, wait a few seconds, and if the search didn't
finish, kill the thread with Thread#stop()
Comment 6 Dani Megert CLA 2005-08-19 05:28:56 EDT
*** Bug 107368 has been marked as a duplicate of this bug. ***
Comment 7 shmuel siegel CLA 2006-02-02 08:03:29 EST
I don't know if this is related but eclipse becomes totally unresponsive when I try to use the regex find dialog with the following pattern
(?:\<|\\x3c|\\074|%3c|\\u003c|%u003c|&\#60;|&\#x003c;|&lt;)(?:m|\\x6d|\\x4d|\\155|\\115|%6d|%4d|\\u006d|\\u004d|%u006d|%u004d|&\#109;|&\#77;|&\#x006d;|&\#x004d;)(?:e|\\x65|\\x45|\\145|\\105|%65|%45|\\u0065|\\u0045|%u0065|%u0045|&\#101;|&\#69;|&\#x0065;|&\#x0045;)(?:t|\\x74|\\x54|\\164|\\124|%74|%54|\\u0074|\\u0054|%u0074|%u0054|&\#116;|&\#84;|&\#x0074;|&\#x0054;)(?:a|\\x61|\\x41|\\141|\\101|%61|%41|\\u0061|\\u0041|%u0061|%u0041|&\#97;|&\#65;|&\#x0061;|&\#x0041;)[^(?:\>|\\x3e|\\076|%3e|\\u003e|%u003e|&\#62;|&\#x003e;|&gt;)(?:\<|\\x3c|\\074|%3c|\\u003c|%u003c|&\#60;|&\#x003c;|&lt;)]+(?:n|\\x6e|\\x4e|\\156|\\116|%6e|%4e|\\u006e|\\u004e|%u006e|%u004e|&\#110;|&\#78;|&\#x006e;|&\#x004e;)(?:a|\\x61|\\x41|\\141|\\101|%61|%41|\\u0061|\\u0041|%u0061|%u0041|&\#97;|&\#65;|&\#x0061;|&\#x0041;)(?:m|\\x6d|\\x4d|\\155|\\115|%6d|%4d|\\u006d|\\u004d|%u006d|%u004d|&\#109;|&\#77;|&\#x006d;|&\#x004d;)(?:e|\\x65|\\x45|\\145|\\105|%65|%45|\\u0065|\\u0045|%u0065|%u0045|&\#101;|&\#69;|&\#x0065;|&\#x0045;)(?:=|\\x3d|\\075|%3d|\\u003d|%u003d|&\#61;|&\#x003d;)[^(?:\>|\\x3e|\\076|%3e|\\u003e|%u003e|&\#62;|&\#x003e;|&gt;)(?:\<|\\x3c|\\074|%3c|\\u003c|%u003c|&\#60;|&\#x003c;|&lt;)]+(?:\>|\\x3e|\\076|%3e|\\u003e|%u003e|&\#62;|&\#x003e;|&gt;)
The text being searched is very short and other regex tools very quickly return "pattern not found", so the symptom is very unexpected.
This is the text being searched
<HTML>
<meta 
name="O12535621387956238746789abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1
2345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrs
tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOP
QRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcde
fgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDE
FGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12
345678abcdefghijklmnopqrstuvwxyz123456O12535621387956238746789abcdefgklmnopqrstu
vwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR
STUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefg
klmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFG
HIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234
5678abcdefgklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefgklmnopqrstuv
wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678abcdefghijklmnopqrstuvwxyz123456" >
</HTML>

I am using eclipse 3.1.2 with java 1.5.0_4 on win2k.
Comment 8 Markus Keller CLA 2009-07-28 14:12:01 EDT
*** Bug 283904 has been marked as a duplicate of this bug. ***
Comment 9 Markus Keller CLA 2011-06-30 10:00:27 EDT
From bug 151736 comment 3: File Search for ".*allowReturn.*" in a 400K file that doesn't contain "allowReturn" also takes excessively long.
Comment 10 John Boyland CLA 2011-06-30 10:59:33 EDT
(In reply to comment #9)
> From bug 151736 comment 3: File Search for ".*allowReturn.*" in a 400K file
> that doesn't contain "allowReturn" also takes excessively long.

NB: It takes excessively long if the file has no line breaks.
Comment 11 Dani Megert CLA 2014-07-29 08:01:27 EDT
*** Bug 440518 has been marked as a duplicate of this bug. ***
Comment 12 Eclipse Genie CLA 2018-11-20 17:35:21 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 13 Lars Vogel CLA 2019-08-08 15:20:28 EDT
This bug has been marked with as "stalebug" for some time now. I mark this bug as "worksforme" to indicate that no work is planned here. 

If this bug is still relevant for the latest release, please reopen the bug and remote the "stalebug" whiteboard tag.