Re: [Httpunit-develop] Upload 1.7.1 to central maven repository - Was: Re: Minor Bug in class Servl
Brought to you by:
russgold
|
From: Wolfgang F. <wf...@bi...> - 2012-10-09 09:54:33
|
Dear Kai, revision 1101 has your fix. Yours Wolfgang Am 03.10.12 11:18, schrieb Kai: > I solved the bug! > > The final step was an upgrade from JUnit 4.7 to JUnit 4.10. > > JUnit 4.7 does not order the execution of Rules and @Before-annnotated > methods correctly. So, my fix lead to several wired failures in > Test-Cases with @Before-annotated methods, when executed with JUnit > 4.7, becaus the PseudoServer wasn't started, when it first was > accessed in the @Before-Method. > > You find my fix in the attached patch. > > I'm runnig the test in an endless-loop now, to be sure, that there is > no other race-condition-issue: > > while (mvn test); do echo date ; done > > I will report, if that exposes any further race-condition-issues. > Otherwise, everything might be ready for an upload :) > > > Regards kai > > Am 28.09.2012 17:05, schrieb Kai: >> I thin, I'm one step closer to a solution! >> >> First of all, I found a simple way, to reproduce the problem on all my >> machines. That was necessary, becaus the test-case >> WebPageTest.testTitle() only freezes on one of my machines (my old solw >> laptop). And lately, it even works there. >> >> The following simple line of shell-code reruns the test-case forever. >> This leads to a freeze after some time on all my machines: >> >> while (mvn test -Dtest=WebPageTest); do echo date; done >> >> So, I hope, now you are able to reproduce the error that I am >> witnessing :) >> >> >> Because I believe, that the root of the error is a race-condition in the >> test-case execution, my next step was, to isolate the single >> test-excecutions even more. Therefor, I changed PseudoServerTestSupport >> into an ExternalRule. >> >> See: >> http://blog.mycila.com/2009/11/writing-your-own-junit-extensions-using.html >> >> and: >> http://kentbeck.github.com/junit/javadoc/4.10/org/junit/rules/ExternalResource.html >> >> >> >> >> The good news: >> Since I've done that, WebPageTest never freezes. The simple loop is >> running on my fastest machine for over an hour now. Before the change, >> it took only some minutes to freeze the test-execution. >> >> The bad news: >> Now a lot of other tests fail :/ >> >> But I think, they are only failing, because they share a common >> preconfigured instance of PseudoServer, which was configured in the >> @BeforeClass-annotated method, that I removed in my quick hack, because >> the PseudoServer-Instance is recreated for every test-run. >> So one only needs two Base-Test-Classes. One for independent test-runs >> (like now after my quick hack) and one in the "old" style with a single >> shared instance of PseudoServer for the whole class. >> >> Unfortunatly, I'm lacking the time to implement these changes now. >> But I will try to find some time next week, to implment the changes. >> >> >> Another question is: >> Perhaps all this just works around a race-condition-bug, which might be >> located in PseudoServer. Another solution to the problem above might be, >> to rework the implementation of PseudoServer. IMHO it might be better, >> for example, to implement the listening threads with >> ExecutorService.execute() and wait() for them when the server is teared >> down... >> >> >> Regards, >> >> kai >> >> Am 23.09.2012 12:45, schrieb Kai Moritz: >>> Am 20.09.2012 13:28, schrieb Russell Gold: >>>> Sounds as though at times PseudoServer has nothing to send. That's the >>>> only way that should happen. But that's kind of odd. Is it the first >>>> read for the page? >>>> >>> Yes, I think so. >>> It is the first property of the WebResponse, which is checked in the >>> Test WebPageTest.testTitle() on line 189: >>> assertEquals("Title", "A Sample Page", simplePage.getTitle()); >>> >>> Regards, >>> kai >>> >>> >>>> On Sep 20, 2012, at 4:38 AM, Kai wrote: >>>>>> >>>>>> Testing always stops at that test-case on my box, sleeping for ever. >>>>>> 100% reproducable. That also happens, if I execute that test >>>>>> standalone >>>>>> with "mvn test -Dtest=WebPageTest". >>>>>> >>>>> I wasn't able to fix that error yet. >>>>> But I can provide some information, which may help tracking it down: >>>>> >>>>> This error surely is caused by some kind of a race-condition. >>>>> >>>>> The test-execution only freezes in one Test: WebPageTest.testTitle(), >>>>> when it tries to fetch the title for comparison in the line >>>>> "assertEquals("Title", "A Sample Page", simplePage.getTitle());" >>>>> >>>>> I debuged my way into the call stack up to >>>>> WebResponse.readFromStream():1157. There, a call to >>>>> inputStream.read() >>>>> is made: >>>>> "count = inputStream.read( buffer, 0, Math.min( maxBytes, >>>>> buffer.length ) );" >>>>> That call never returns. >>>>> >>>>> It may, again, be a race-condition in PseudoServer. >>>>> But this is only a guess. >>>>> >>>>> I will try to find out more later... >>> >> > -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |