[
https://issues.apache.org/jira/browse/ZOOKEEPER-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16377073#comment-16377073
]
ASF GitHub Bot commented on ZOOKEEPER-2977:
-------------------------------------------
GitHub user sumitagrawl opened a pull request:
https://github.com/apache/zookeeper/pull/474
ZOOKEEPER-2977: Concurrency for addAuth corrupts quorum packets
get copy of authInfo in ServerCnxn to avoid corrupt of quorum packets
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sumitagrawl/zookeeper branch-3.4
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zookeeper/pull/474.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 #474
----
commit 870e2d98b1c5b8847b8f32c9d5f0a49ad696812c
Author: sumitagrawal <sumit.jecrc@...>
Date: 2018-02-26T15:52:46Z
ZOOKEEPER-2977: Concurrency for addAuth corrupts quorum packets
get copy of authInfo in ServerCnxn
----
> Concurrency for addAuth corrupts quorum packets
> -----------------------------------------------
>
> Key: ZOOKEEPER-2977
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2977
> Project: ZooKeeper
> Issue Type: Bug
> Components: quorum
> Affects Versions: 3.4.9
> Environment: Affects all version in 3.4.x
> Reporter: sumit agrawal
> Priority: Critical
> Fix For: 3.4.12
>
> Attachments: 2977.patch
>
>
> When client performs multiple times addAuth with different credential at
> follower concurrently, the communication between follower gets corrupt. This
> causes shutdown of Follower due to the failure.
> Analysis:
> In org.apache.zookeeper.server.quorum.QuorumPacket.serialize method,
> * call a_.startVector(authinfo,"authinfo"); which write the length of
> authinfo to packet (suppose it writes length 1)
> * get length of authinfo to write all details in loop (here gets length as 2)
> <-- Here in concurrency scenario, buffer gets corrupt having extra bytes in
> channel for additional authinfo.
>
> So When Leader reads next quorum packet, it reads previous extra bytes
> (incorrect) and possibly identify greater size of message (as corrupt byte
> pattern) causes exception...
> Coordination > Unexpected exception causing shutdown while sock still open
> (LearnerHandler.java:633)
> java.io.IOException: Unreasonable length = 1885430131
>
>
> ServerCnxn.getAuthInfo returns Unmodifiable list, but while addAuthInfo,
> there is no check. So this causes concurrency issue.
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)