[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619147#action_12619147
 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-108:
--------------------------------------------------

When calling sync() with multiple asynchronous requests pending, a zookeeper 
server delivers the requests out of order. For example, if a client submits a 
request, say an asynchronous create, followed by a sync, then the zookeeper 
server the client is connected to might deliver the sync and create in the 
inverse order, causing the client to drop the connection. This happens because 
pendingSyncs in CommitProcessor is updated in the wrong place. 

In the attached patch, I have moved pendingSyncs to FollowerZooKeeperServer, 
and have made pendingSyncs thread safe by using a ConcurrentLinkedQueue. Note 
that there is also code on Leader.java to handle syncs, and I have added code 
to process syncs locally in the case the client is connected to the leader.



> sync implementation reorders operations
> ---------------------------------------
>
>                 Key: ZOOKEEPER-108
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-108
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-108.patch
>
>
> The current implementation of sync is broken. There is a race condition that 
> causes a follower to return operations out of order, causing clients to drop 
> their connections to a server.
> I'll be attaching a patch to fix this problem shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to