You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Sijie Guo (JIRA)" <ji...@apache.org> on 2012/12/14 10:06:13 UTC

[jira] [Updated] (BOOKKEEPER-507) Race condition happens if closeSubscription and subscribe happened at the same time (in multiplexed client).

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

Sijie Guo updated BOOKKEEPER-507:
---------------------------------

    Attachment: subscribeshouldrespondafterstartserving.patch

although we have queue in hub server to guarantee request for a topic is run in order using queue. 

so for a subscribe/unsubscribe/closesubscription request, it would goes topicmanager -> subscriptionmanager -> deliverymanager in order.

but for subscribe request, we respond too early before startServingSubscription is executed. so two response are sent out-of-order.

Attached a draft patch to resolve this issue by sending respond when #startServingSubscription is executed.

the patch doesn't include a test case. I would try to add one later.
                
> Race condition happens if closeSubscription and subscribe happened at the same time (in multiplexed client).
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-507
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-507
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>            Priority: Blocker
>             Fix For: 4.2.0
>
>         Attachments: subscribeshouldrespondafterstartserving.patch
>
>
> 1) closesub first
> 2) sub late
> 3) closesub succeed, but response is delayed to client.
> 4) since closesub succeed in server side, so sub succeed and tried to deliver message.
> 5) sub response is back
> 6) client checked and found that there is already a subscriber there.
> 7) client failed the subscribe request
> 8) but the message would still be delivered to same channel. since the sub state is not be cleared. message is still be received.
> 9) closesub response is back.
> 10) it clear the subscribe state.
> 11) message continue delivering but found there is no subscriber state.
> at step 11) the problem happened.
> this race condition is introduced in multiplexed client (BOOKKEEPER-70).

--
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