[jboss-as7-dev] EJB - org.jboss.as.ejb3.pool.strictmax.StrictMaxUnitTestCase accidentally failed (race-condition?)
Jason T. Greene
jason.greene at redhat.com
Mon Mar 5 11:36:51 EST 2012
The test is relying on Thread.sleep, which certainly explains the
behavior. A better version would have all in-use threads block on a
countdown latch, until the pool is full, then verify the max is effective.
On 3/5/12 7:28 AM, Carlo de Wolf wrote:
> Usually this would only happen on my hardware. :-)
>
> This is a possibility. The test tries to run up 20 threads on a 10 sized
> pool. In essence your run never got 10 instances going, but only 9.
>
> What are your hardware specs?
>
> Carlo
>
> On 03/05/2012 02:17 PM, Pavel Janousek wrote:
>> Hi,
>>
>> I've got for the first time (and only one) that testcase org.jboss.as.ejb3.pool.strictmax.StrictMaxUnitTestCase accidentally failed - see stacktrace bellow.
>>
>> Because it is some multithread testcase, it is possible that this accident should be a race-condition error.
>>
>> Could someone who is expert of this part of AS7 code review if there isn't really some issue?
>>
>> Thanks
>>
>> Pavel
>>
>> -------------------------------------------------------------------------------
>> Test set: org.jboss.as.ejb3.pool.strictmax.StrictMaxUnitTestCase
>> -------------------------------------------------------------------------------
>> Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.067 sec<<< FAILURE!
>> testMultiThread(org.jboss.as.ejb3.pool.strictmax.StrictMaxUnitTestCase) Time elapsed: 2.031 sec<<< FAILURE!
>> junit.framework.AssertionFailedError: expected:<10> but was:<9>
>> at junit.framework.Assert.fail(Assert.java:50)
>> at junit.framework.Assert.failNotEquals(Assert.java:287)
>> at junit.framework.Assert.assertEquals(Assert.java:67)
>> at junit.framework.Assert.assertEquals(Assert.java:199)
>> at junit.framework.Assert.assertEquals(Assert.java:205)
>> at org.jboss.as.ejb3.pool.strictmax.StrictMaxUnitTestCase.testMultiThread(StrictMaxUnitTestCase.java:117)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at junit.framework.TestCase.runTest(TestCase.java:168)
>> at junit.framework.TestCase.runBare(TestCase.java:134)
>> at junit.framework.TestResult$1.protect(TestResult.java:110)
>> at junit.framework.TestResult.runProtected(TestResult.java:128)
>> at junit.framework.TestResult.run(TestResult.java:113)
>> at junit.framework.TestCase.run(TestCase.java:124)
>> at junit.framework.TestSuite.runTest(TestSuite.java:243)
>> at junit.framework.TestSuite.run(TestSuite.java:238)
>> at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>> at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
>> at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
>> at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
>> at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
>> at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
>> at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
>> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
>>
>>
>> --
>> Pavel Janousek
>> Senior JBoss QA Engineer
>>
>>
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
--
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat
More information about the jboss-as7-dev
mailing list