You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Flavio Junqueira (Updated) (JIRA)" <ji...@apache.org> on 2011/11/25 15:53:40 UTC

[jira] [Updated] (BOOKKEEPER-53) race condition of outstandingMsgSet@SubscribeResponseHandler

     [ https://issues.apache.org/jira/browse/BOOKKEEPER-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Junqueira updated BOOKKEEPER-53:
---------------------------------------

    Attachment: BOOKKEEPER-53.patch

This is a patch to fix this issue. Note that there is no ConcurrentHashSet implementation in java.util.concurrent, and the way I found to get it is to use a method from Collections. The examples I've been able to find suggest to use a Boolean, but for correctness it sounds like it doesn't matter. 
                
> race condition of  outstandingMsgSet@SubscribeResponseHandler 
> --------------------------------------------------------------
>
>                 Key: BOOKKEEPER-53
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-53
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: hedwig-client
>    Affects Versions: 4.0.0
>            Reporter: xulei
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-53.patch
>
>
> outstandingMsgSet is a Set, so it is not thread-safe. The detail is as below:
> MessageConsumeRetryTask is In a timer, so in timer thread, when the timer is up, it will cause a outstandingMsgSet add operation:
> MessageConsumeRetryTask.run() -> outstandingMsgSet.add(message) -> outstandingMsgSet.add(message)
> At the same time, in other thread(maybe main thread), there may be other operations of this outstandingMsgSet:
> MessageConsumeCallback.operationFinished() -> messageConsumed(Message message) -> outstandingMsgSet.remove(message);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira