CPU usage goes to 100% after JUnit test [message #530327] |
Thu, 29 April 2010 07:51  |
Eclipse User |
|
|
|
Every time I do a JUnit test that extends AbstractTransactionalSpringContextTests Eclipse.exe CPU consumption goes to 100% for a minute or so after the test is already finished. Is there any reason why the Eclipse's JUnit plugin would keep consuming the CPU at such a high rate even after the test is finished?
|
|
|
|
|
|
Re: CPU usage goes to 100% after JUnit test [message #534603 is a reply to message #534344] |
Wed, 19 May 2010 11:39   |
Eclipse User |
|
|
|
"Haroldo de Oliveira Pinheiro" <haroldo@atsinformatica.com.br> wrote in
message news:hsum46$hjt$1@build.eclipse.org...
> Well, first of all, sorry for the delay, but only no I hav been able to
> come back to what I was doing initially.
>
> This is a core dump from immediately after running the automated tests
> (the test has been finished, but Eclipse is still eating up the CPU)
>
>
> 2010-05-18 15:01:45
> Full thread dump Java HotSpot(TM) Client VM (11.0-b15 mixed mode):
>
> [...]
>
> "Worker-5" prio=6 tid=0x56c85000 nid=0x898 runnable
> [0x57fbf000..0x57fbfd94]
> java.lang.Thread.State: RUNNABLE
> at java.util.regex.Pattern$Slice.match(Pattern.java:3479)
> 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:3 366)
> 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$MatchJ ob.run(ConsolePatternMatcher.java:127)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> Two minutes later, Eclipse's CPU consumption returns to sane levels:
>
> 2010-05-18 15:03:34
> Full thread dump Java HotSpot(TM) Client VM (11.0-b15 mixed mode):
>
> [...]
> Well, does this help, somehow?
What we're looking for is threads that are RUNNABLE in the busy state and
missing or not RUNNABLE in the quiet state. The culprit appears to be the
one I've excerpted above. The question is, what is searching for what
pattern in what text?
So, I selected the Plug-in Development perspective, opened the Plug-ins
view, and selected the org.eclipse.ui.console plug-in. I right-clicked and
selected "import as Source Project" to get the source code for it. Taking a
look at the ConsolePatternMatcher code, it seems like it is trying to match
text patterns in a text console. I'm guessing it's looking at the output of
the test run and searching for strings like "Error", but that is just a
guess. I am not sure who is instantiating this particular
ConsolePatternMatcher.
If you have a way for someone else to reproduce the bug, you could try
reporting it - I would report it against the platform, not JDT, as there is
nothing specific to JDT here. What would be better, though, is if you can
chase it down a bit farther. To do that, I would create a host workspace
that simply has the org.eclipse.ui.console plug-in source in it; from that
host workspace I would launch a target Eclipse instance (Debug As... Eclipse
Application), pointing that instance to your existing workspace (you do this
in the launch configuration). In the host instance, use Ctrl+Shift+T to
open the Pattern.java source code from the JDK source (make sure you get the
right one, there are a lot of classes named Pattern) and navigate to line
3479.
Then, try to reproduce the problem, and sometime in the busy two minutes,
put a breakpoint on line 3479. You should see it get hit instantly. At
that point you can navigate up the stack back to
ConsolePatternMatcher$MatchJob.run to see some of the details of the console
and pattern in question - maybe you'll be able to get a better sense of
what's going on. You might also put a breakpoint on the
ConsolePatternMatcher constructor, to see who instantiates it (you might
need to import source for some other plug-ins, at that point).
Good luck!
|
|
|
Re: CPU usage goes to 100% after JUnit test [message #534663 is a reply to message #530327] |
Wed, 19 May 2010 15:11  |
Eclipse User |
|
|
|
You're right, it was the console.
I made a quick and dirty test by dumping all the console output to a file, and then making a small JUnit test that simply read from this text file, line by line, and dumped it to the console, with no additional processing. The result: 2 minutes of CPU hogging.
Due to time constraints, I'll, for now, take the easy path and simply log to file; I may do some actual testing later on, if I get the chance.
If anyone wants to have a try at isolating the cause of the console problem, here's the aforementoned log:
http://dl.dropbox.com/u/1235428/work/invalid%20BLOB%20ID.zip
Thanks for your help.
|
|
|
Powered by
FUDForum. Page generated in 0.02694 seconds