Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342269 - Eclipse hangs in java.util.regex.Matcher.find() for some output in the Console
Summary: Eclipse hangs in java.util.regex.Matcher.find() for some output in the Console
Status: CLOSED DUPLICATE of bug 175888
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-08 07:42 EDT by Aaron Digulla CLA
Modified: 2011-04-08 11:45 EDT (History)
1 user (show)

See Also:


Attachments
Thread dump while the UI hangs (62.54 KB, application/octet-stream)
2011-04-08 08:29 EDT, Aaron Digulla CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Digulla CLA 2011-04-08 07:42:12 EDT
Build Identifier: 20110218-0911

For a couple of days, I had spurious lock ups/hangs of the Eclipse UI while tests were running.

In the CPU monitor, I could see something hog a CPU core for 100%.

Using jps and jstat, I could nail it down to this stack trace:

at java.util.regex.Pattern$Curly.match0(Pattern.java:3782)
at java.util.regex.Pattern$Curly.match(Pattern.java:3744)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3366)
at java.util.regex.Pattern$Start.match(Pattern.java:3055)
at java.util.regex.Matcher.search(Matcher.java:1105)
at java.util.regex.Matcher.find(Matcher.java:561)
at org.eclipse.ui.internal.console.
ConsolePatternMatcher$MatchJob.run(ConsolePatternMatcher.java:127)

Now my problem is: How can I find out *which* regexp causes this?

I have the console output in a file, so I could run all the regexps against it to see which one causes the problem.

Is there some command/script that I could write to get a list of all regexps?

Also: Why is this locking up the UI? Can't the partitioning of the console content happen in the background?

Maybe you should add timeouts to code that runs regexps because it's a known fact that some regexps need an surprising amount of CPU in some corner cases.

Reproducible: Always
Comment 1 Aaron Digulla CLA 2011-04-08 08:29:33 EDT
Created attachment 192821 [details]
Thread dump while the UI hangs
Comment 2 Michael Rennie CLA 2011-04-08 10:06:07 EDT
Looks like a dupe of bug 175888. 

Aaron, what kind of console is the output going to (stacktrace, I/O, etc)? Are you outputting a lot of data to the console? Or really long lines of data?

> Now my problem is: How can I find out *which* regexp causes this?

I guess your best bet would be to profile it. 

You could also try running your tests on a vanilla Eclipse and see if the problem occurs - then you would know if the problem is in the platform or a plugin that contributes their own pattern matcher.

> Is there some command/script that I could write to get a list of all regexps?

Sadly, you would have to debug the class ConsoleManager from org.eclipse.ui.console and inspect the fPatternMatchListeners collection

> Also: Why is this locking up the UI? Can't the partitioning of the console
> content happen in the background?

The matching, etc. is done in the background, but in certain cases - writing out large lines of text to the UI widgetry for example - can cause Eclipse to bog right down.
Comment 3 Aaron Digulla CLA 2011-04-08 11:45:12 EDT
(In reply to comment #2)

> Looks like a dupe of bug 175888. 

Probably. I've commented there and closed this bug as a duplicate.

*** This bug has been marked as a duplicate of bug 175888 ***