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?