Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2977

Concurrency for addAuth corrupts quorum packets

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.4.9
    • Fix Version/s: None
    • Component/s: quorum
    • Environment:

      Affects all version in 3.4.x

    • Tags:
      Quorum, shutdown

      Description

      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.

       

       

       

       

        Attachments

        1. 2977.patch
          2 kB
          sumit agrawal

          Issue Links

            Activity

              People

              • Assignee:
                sumitagrawal sumit agrawal
                Reporter:
                sumitagrawal sumit agrawal
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m