-
1. Re: Modeshape 4: transactional changes visibility bug?
hchiorean Jul 23, 2015 3:28 AM (in response to ibodrov)While there may be an issue somewhere, the test case is highly unusual: you're starting a transaction off thread X and then suspending & resuming the same transaction of threads Y, Z etc. So essentially you're "forcibly" changing the [thread,tx] association for the same transaction. While the transaction API doesn't prevent you from doing this, IMO it's not a regular test case/usage pattern.
If for example, you keep the start/suspend/resume off the same thread in your test case (e.g. the main thread) the code runs fine. I will investigate this some more, but in the meantime as a workaround try to avoid forcibly changing the tx/thread association and keep the suspend/resume call to the same thread where the transaction was originally started from.
-
2. Re: Modeshape 4: transactional changes visibility bug?
ibodrov Jul 23, 2015 3:38 AM (in response to hchiorean)Well, thats the point - we are using "long" transactions in our application which spans across multiple threads.
We had it working pretty well in Mode 3.x and i think in Mode 4.0 beta but not in Mode 4.3 -
3. Re: Modeshape 4: transactional changes visibility bug?
hchiorean Jul 23, 2015 5:16 AM (in response to ibodrov)Spanning across multiple threads - i.e. separate threads having their own transactions while the "main" one is being suspended - is not the problem. The problem is these threads are committing a transaction which was not originally spawned for them. This is not a typical "long transaction" use case IMO.
Running your test case on 3.8.1.Final on my machine produces the following output:
12:13:35,959 WARN ISPN000100: Stopping, but there are 1 local transactions and 0 remote transactions that did not finish in time. java.lang.AssertionError: Found a child reference in /{}parent/{}nested to a non-existant child {}child at org.modeshape.jcr.JcrSession.cachedNode(JcrSession.java:614) at org.modeshape.jcr.JcrSession.node(JcrSession.java:641) at org.modeshape.jcr.JcrSession.node(JcrSession.java:660) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:844) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:827) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:134) at org.modeshape.jcr.TransactionsTest.testCommit(TransactionsTest.java:492)
so I doubt this type of scenario works correctly in 3.x.
-
4. Re: Modeshape 4: transactional changes visibility bug?
hchiorean Jul 23, 2015 6:03 AM (in response to hchiorean)I've opened [MODE-2495] Transactional changes not propagated correctly when using user transactions shared by multiple threads - JBo… which I'll look at for 4.4.
-
5. Re: Modeshape 4: transactional changes visibility bug?
ibodrov Jul 23, 2015 12:08 PM (in response to hchiorean)Thanks! I'll try to workaround by pinning the transaction's thread.