1 Reply Latest reply on Dec 20, 2007 7:04 PM by marklittle

    Thread safety and rollback

      I know this is "invalid usage", but it still shouldn't lead to broken behaviour. :-)

      See the test in jboss-4.2

      $ ./build.sh one-test -Dtest=org.jboss.test.tm.test.CompetingRollbackStressTestCase
      


      This is stress test for a race condition (two threads invoking rollback
      "at the same time"). I'm seeing the transaction synchronizations getting invoked twice.

       <testcase classname="org.jboss.test.tm.test.CompetingRollbackStressTestCase" name="testExecuteSQLDuringRollback" time="7.132">
       <error message="Synchronization invoked 2 times" type="org.jboss.test.util.ejb.RemoteTestException">java.lang.RuntimeException: Synchronization invoked 2 times
       at org.jboss.test.tm.test.CompetingRollbackStressTestCase$Main.test(CompetingRollbackStressTestCase.java:136)
       at org.jboss.test.tm.test.CompetingRollbackStressTestCase$TestRunnable.run(CompetingRollbackStressTestCase.java:193)
       at java.lang.Thread.run(Thread.java:595)
      


      NOTE: This is a stress test, so you'll probably have to make it do
      lots of iterations to reproduce the problem. e.g. start jboss with

      $ ./run.sh -Djbosstest.iterationcount=10000
      


      and maybe run it a few times?

        • 1. Re: Thread safety and rollback
          marklittle

          Participants (two phase and synchronizations) may get called multiple times in the event of certain types of failures (e.g., the tm sends a prepare, doesn't get a response and so sends it again) so they should expect this kind of behaviour. But in this case it isn't a failure, it's a bug ;-)