You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/09 19:23:00 UTC

[jira] [Commented] (IGNITE-9384) Transaction state PREPARED may be set too early or too late

    [ https://issues.apache.org/jira/browse/IGNITE-9384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608548#comment-16608548 ] 

ASF GitHub Bot commented on IGNITE-9384:
----------------------------------------

GitHub user agura opened a pull request:

    https://github.com/apache/ignite/pull/4707

    IGNITE-9384 Transaction status can be set incorrectly due to a race on prepare phase

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/agura/incubator-ignite ignite-9384

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/4707.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4707
    
----
commit b14943f33dea9e998ea6d5a9c2570d60d16458d2
Author: agura <ag...@...>
Date:   2018-09-09T19:21:36Z

    IGNITE-9384 Transaction status can be set incorrectly due to a race on prepare phase

----


> Transaction state PREPARED may be set too early or too late
> -----------------------------------------------------------
>
>                 Key: IGNITE-9384
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9384
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Alexey Goncharuk
>            Assignee: Andrey Gura
>            Priority: Major
>             Fix For: 2.7
>
>
> I see the following issues in the {{GridDhtTxPrepareFutureAdapter}} class:
> 1) {{PREPARED}} state on near local transaction may be set during the future completion. I think the {{onComplete(res)}} method should be corrected as follows:
> {code}
>         if (last || tx.isSystemInvalidate() && !(tx.near() && tx.local()))
>             tx.state(PREPARED);
> ...
> {code}
> 2) In {{onDone}} we have the following code:
> {code}
>             if (REPLIED_UPD.compareAndSet(this, 0, 1)) {
>                 GridNearTxPrepareResponse res = createPrepareResponse(this.err);
>                 try {
>                     sendPrepareResponse(res);
>                 }
>                 finally {
>                     // Will call super.onDone().
>                     onComplete(res);
>                 }
>                 return true;
>             }
> ...
> {code}
> This code will send near prepare response to the near node before the local DHT transaction sets it's state to {{PREPARED}} which violates the invariant that all transactions are prepared before any of the transactions is committed. I think these two methods should be swapped, but we need to carefully check the error handling (note that {{onComplete}} is called in {{finally}} block).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)