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

state of zk_handle should NOT be initialized to 0 (CLOSED) in zokeeper_init. It should have a not initialized state.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.3.3
    • None
    • c client
    • None

    Description

      In zoo_add_auth, we have following check.
      2954 // ZOOKEEPER-800 zoo_add_auth should return ZINVALIDSTATE if
      2955 // the connection is closed.
      2956 if (zoo_state(zh) == 0) {
      2957 return ZINVALIDSTATE;

      when we do zookeeper_init, the state is initialized to 0 and above we check if state = 0 then throw exception.
      There is a race condition where the doIo thread is slow and has not changed the state to CONNECTING, then you end up returning back ZKINVALIDSTATE from zoo_add_auth.
      The problem is we use 0 for CLOSED state and UNINITIALIZED state. in case of uninitialized case it should let it go through.
      Is this intentional? In java we have the uninitialized state = null.
      If not we can initialize it to some other magic number.

      Attachments

        Activity

          People

            dheerajagrawal Dheeraj Agrawal
            dheerajagrawal Dheeraj Agrawal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: