Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342269

Summary: Eclipse hangs in java.util.regex.Matcher.find() for some output in the Console
Product: [Eclipse Project] JDT Reporter: Aaron Digulla <digulla>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Thread dump while the UI hangs none

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 ***