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

C client bug in zookeeper_init (if bad hostname is given)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.3.2, 3.4.6, 3.5.0
    • Fix Version/s: 3.4.7, 3.5.2, 3.6.0
    • Component/s: c client
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Tags:
      c client, adaptor_init, zookeeper_init, bad hostname

      Description

      If you give invalid hostname to zookeeper_init method, it's not able to resolve it, and it tries to do the cleanup (free buffer/completion lists/etc) . The adaptor_init() is not called for this code path, so the lock,cond variables (for adaptor, completion lists) are not initialized.

      As part of the cleanup it's trying to clean up some buffers and acquires locks and unlocks (where the locks have not yet been initialized, so unlocking fails)
      lock_completion_list(&zh->sent_requests); - pthread_mutex/cond not initialized
      tmp_list = zh->sent_requests;
      zh->sent_requests.head = 0;
      zh->sent_requests.last = 0;
      unlock_completion_list(&zh->sent_requests);  trying to broadcast here on uninitialized cond

      It should do error checking to see if locking succeeds before unlocking it. If Locking fails, then appropriate error handling has to be done.

        Attachments

        1. ZOOKEEPER-1029-3.5.patch
          9 kB
          Flavio Junqueira
        2. ZOOKEEPER-1029-3.5.patch
          9 kB
          Flavio Junqueira
        3. ZOOKEEPER-1029-3.4.patch
          3 kB
          Flavio Junqueira
        4. ZOOKEEPER-1029-3.4.patch
          4 kB
          Flavio Junqueira
        5. ZOOKEEPER-1029-3.4.patch
          4 kB
          Flavio Junqueira
        6. ZOOKEEPER-1029-3.4.patch
          5 kB
          Flavio Junqueira
        7. ZOOKEEPER-1029-3.4.patch
          8 kB
          Flavio Junqueira
        8. ZOOKEEPER-1029-3.4.patch
          8 kB
          Flavio Junqueira

          Issue Links

            Activity

              People

              • Assignee:
                fpj Flavio Junqueira
                Reporter:
                dheerajagrawal Dheeraj Agrawal
              • Votes:
                3 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: