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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.3.2, 3.4.6, 3.5.0
    • 3.4.7, 3.5.2, 3.6.0
    • c client
    • None
    • Reviewed
    • 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.4.patch
          8 kB
          Flavio Paiva Junqueira
        2. ZOOKEEPER-1029-3.4.patch
          8 kB
          Flavio Paiva Junqueira
        3. ZOOKEEPER-1029-3.4.patch
          5 kB
          Flavio Paiva Junqueira
        4. ZOOKEEPER-1029-3.4.patch
          4 kB
          Flavio Paiva Junqueira
        5. ZOOKEEPER-1029-3.4.patch
          4 kB
          Flavio Paiva Junqueira
        6. ZOOKEEPER-1029-3.4.patch
          3 kB
          Flavio Paiva Junqueira
        7. ZOOKEEPER-1029-3.5.patch
          9 kB
          Flavio Paiva Junqueira
        8. ZOOKEEPER-1029-3.5.patch
          9 kB
          Flavio Paiva Junqueira

        Issue Links

          Activity

            People

              fpj Flavio Paiva Junqueira
              dheerajagrawal Dheeraj Agrawal
              Votes:
              3 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: