Community
Participate
Working Groups
Build Identifier: I20110518-2200 in this view: Window->Show View, Java->JUnit that is, when running the tests, sometimes the view gets stuck on the last test as if the test is blocking (but I have reason to believe it doesn't esp. since a (stop&)rerun will not block again). So basically it will never return and I cannot see which tests failed and which not, because this only gets shown when all tests are done. The only thing to do is to press the red stop button, then rerun all tests (which will not block again this time) It's tough to catch this, so I'll include the thread dump from the time when it did get stuck (luckily I was running the eclipse the right way for thread dump and dumped it with visualvm 1.3.2) Reproducible: Sometimes Steps to Reproduce: (this "bug" is not restricted to e4, I've ran into this before on previous eclipses ie. 3.6-3.7) I don't know how to reproduce it, but last time it happened when previous junit run had errors and pressing the Rerun Test button (the green one with a white play and yellow shortcut arrow on bottom right) caused it to not return (as seen in picture) although the test was done.
Created attachment 196267 [details] this is how it looks when it never returns (same as when it runs, I know)
Created attachment 196268 [details] the thread dump when it's stuck like that, if it helps
Created attachment 196314 [details] another thread dump when it happened again it's stuck at the last test, ie. it forgot to finish :) but all tests indeed finished, ie. it's not stuck in the test
Created attachment 196317 [details] this is how JUnit view looks when it's stuck this is the screenie from the previous (again) thread dump
The thread hanging at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$JUnitIsRunningJob.run(TestRunnerViewPart.java:841) indicates that the test run didn't terminate properly. It's hard to tell what's going on without a reproducible test case. Is there anything special about these last tests or the test suite? E.g. do they use special test runners, or run tests in parallel like ActiveTestSuite, ...? Are these JUnit 3 or JUnit 4 tests?
they are JUnit 4 tests they don't run anything in parallel, I'd say they are pretty normal tests although the ones in this case do use some database which had locks (but I strongly doubt any deadlocks happened which caused hang) The tests as the code they run for are designed to run only in 1 thread (well unless BerkeleyDB JE aka java edition doesn't run its own threads or something) using junit-4.9b2.jar but these hangs have happened to me before in previous eclipses such as galileo even and when I used standard junit library, not hand-added one. thing is I can't really reproduce them, the tests run fine , they only sometimes hang and after I stop the hang and rerun they don't hang again (even without modifying anything in them) all tests use @Before and @After and @Test annotations only, ie. no @AfterClass (or what's it called, though if I do add that then I would most likely see that finish before the hang happens, sort of indicating that tests did finish - did this in one case months before and I remember the hang happening after the @AfterClass of the main runall tests suite) tests are also (sometimes) ran via the main suite like this one: @RunWith( Suite.class ) @Suite.SuiteClasses( value = { A.class, B.class, C.class, D.class, E.class } ) public class AllTestsGo { } but the A,B,C etc. classes (simplified here) are simple @Test and @Before and @After (sometimes) junit tests Even if I find a testcase of tests that do hang , they will only hang that time, and most I could do is thread dump? trying to make them hang again may take about 1 day of normal development (as I do it anyway)
Thanks for the info. So, the approach to fix the problem will be to dive into the code listens for test run session termination and that updates the view, so as to make sure it's properly synchronized.
Created attachment 196678 [details] another thread dump when stuck at the last test without returning I wonder if there's more I can "dump" or something to do to get more info and help with this
Created attachment 196683 [details] same TD as prev one, except this was dumped 19 mins later I didn't stop or do anything to the stuck junit test since the previous dump, I was only checking the prev dump contents in visualvm while time was elapsing
Created attachment 196690 [details] this is the TD after I pressed the stop button (1 hour and 1 min later) the only thing I did (other than just wait for an hour) was I clicked the red stop button in junit view and then proceeded to thread dump
Created attachment 196691 [details] this is a TD after I reran the tests and the last test was modified to sleep 10 sec I took the TD while it was sleeping, then after it slept the test runs ended normally
Created attachment 196693 [details] this is the TD right after the above one, it's after all tests ended successfully that is, after those 10 seconds elapsed(and tests finished) I did a thread dump. there were no errors in in the tests in all 4 previous thread dumps. All 5 of the last dumps(that means: includes this one) are connected, they are of the same eclipse session and as specified in their description.
I don't think we'll get any more information out of stack dumps. This is a timing issue that causes a bad internal state in the updating code, so the bad information could only be found in a memory dump. I currently don't have time to debug this, but the way I would approach it is by walking backwards from the code that updates the UI and see where the update is triggered. Then I would set some breakpoints to delay the updating and see if I can reliably reproduce the problem then.
Hi, I can confirm the existence of this issue. I found that after the last test case was finished, the status bar does not get refreshed, but it stated that all the tests are done. (Runs: 2/2) org.eclipse.jdt.junit - 3.7.0.v20110505-0800 org.eclipse.jdt.junit.core - 3.7.0.v20110518-0800 Thanks, Attila
Just to indicate that this problem is also in the latest Eclipse build (Luna). If it can help, my tests are parameterized (@RunWith(Parameterized.class))
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.