[infinispan-issues] [JBoss JIRA] (ISPN-2891) Gap in time between commit of transaction and actual value update

Galder ZamarreƱo (JIRA) jira-events at lists.jboss.org
Fri May 24 12:43:07 EDT 2013


    [ https://issues.jboss.org/browse/ISPN-2891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776922#comment-12776922 ] 

Galder ZamarreƱo commented on ISPN-2891:
----------------------------------------

The problem is that the cache value is checked before the transaction's synchronization has completed the afterComplete(): https://gist.github.com/galderz/2c2a5f236f2cd33a2697

Using synchronization relaxes when the cache updates happen, and is not suitable for a use case such as this where the cache is used to maintain a counter. So, you should try disabling synchronization and using XA transactions. It will be slower, but with higher consistency guarantees.

In terms of app server configuration, I suspect the cache is configured with {{<transaction mode="NON_XA"...}} and it should be: {{<transaction mode="NON_DURABLE_XA"...}}
                
> Gap in time between commit of transaction and actual value update
> -----------------------------------------------------------------
>
>                 Key: ISPN-2891
>                 URL: https://issues.jboss.org/browse/ISPN-2891
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Transactions
>    Affects Versions: 5.2.1.Final
>            Reporter: Jim Crossley
>            Assignee: Mircea Markus
>              Labels: 5.2.x
>             Fix For: 5.3.0.CR1, 5.3.0.Final
>
>         Attachments: bad.log, good.log, pessimistic.log, ugly.log
>
>
> Since upgrading our AS7.2 dependency in Immutant (transitively pulling in 5.2.1.Final), one of our integration tests has begun failing intermittently on our CI server. We've yet to see the failure in local runs, only on CI, so I suspect there's something racist going on.
> The two tests (one for optimistic locking, the other for pessimistic) integrate an Infinispan cache (on which the Immutant cache is built) with HornetQ and XA transactions. A number of queue listeners respond to messages by attempting to increment a value in the cache. The failure occurs with both locking schemes, but much more often with optimistic.
> We've confirmed the failure on 5.2.2 as well.
> Attached you'll find three traces of the optimistic test: the good, the bad, and the ugly. All three correspond to this test: https://github.com/immutant/immutant/blob/31a2ef6222088ccb828898e9e3e4531e0333d517/integration-tests/apps/caching/counter/test/counter/test/locking.clj
> So you can correlate the log messages prefixed with "JC:" in the traces to the code. Note in particular the last two lines in locking.clj: a logged message containing the count, and then an assertion of the count. Note that the "bad" trace was an actual failing test, but the "ugly" trace was a successful test, even though the trace clearly shows the count logged as 2, not 3. The Infinispan TRACE output clearly shows the value as 3, hence the ugliness of this test.
> It's important to understand that the "work" function occurs within an XA transaction. This means, as I understand it, that if three messages are published to "/queue/done", the cached count should equal 3. Line #44 in locking.clj will block until it receives 3 messages, after which the cached count should be 3.
> These tests always pass locally. They only ever fail on CI, which runs *very* slowly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the infinispan-issues mailing list