ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-800

zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.3.2, 3.4.0
    • Component/s: c client
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      This happened when I called zoo_add_auth() immediately after zookeeper_init(). It took me a while to figure out that authentication actually failed since zoo_add_auth() returned ZOK. It should return ZINVALIDSTATE instead.

      --Michi

      1. ZOOKEEPER-800.patch
        1 kB
        Michi Mutsuzaki

        Activity

        Hide
        Dheeraj Agrawal added a comment -

        I think this is a race condition. I just raised another ticket for this.
        2940 // ZOOKEEPER-800 zoo_add_auth should return ZINVALIDSTATE if
        2941 // the connection is closed.
        2942 if (zoo_state(zh) == 0)

        { 2943 return ZINVALIDSTATE; 2944 }

        When we initialize we assign zk->state=0 and here we check if its 0 return ZKINVALIDSTATE.
        So in my case: where i am trying to addAuth right after zookeeper_init(), it sometime returns me ZKINVALIDSTATE (as the state might have not changed to CONNECTING), where as i would expect it to queue the request for me (as is done in the java client)

        The problem might be that we are using 0 for both CLOSED and UNINITIALIZED state.

        Show
        Dheeraj Agrawal added a comment - I think this is a race condition. I just raised another ticket for this. 2940 // ZOOKEEPER-800 zoo_add_auth should return ZINVALIDSTATE if 2941 // the connection is closed. 2942 if (zoo_state(zh) == 0) { 2943 return ZINVALIDSTATE; 2944 } When we initialize we assign zk->state=0 and here we check if its 0 return ZKINVALIDSTATE. So in my case: where i am trying to addAuth right after zookeeper_init(), it sometime returns me ZKINVALIDSTATE (as the state might have not changed to CONNECTING), where as i would expect it to queue the request for me (as is done in the java client) The problem might be that we are using 0 for both CLOSED and UNINITIALIZED state.
        Hide
        Hudson added a comment -

        Integrated in ZooKeeper-trunk #976 (See https://hudson.apache.org/hudson/job/ZooKeeper-trunk/976/)
        ZOOKEEPER-800. zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE (michi mutsuzaki via mahadev konar)

        Show
        Hudson added a comment - Integrated in ZooKeeper-trunk #976 (See https://hudson.apache.org/hudson/job/ZooKeeper-trunk/976/ ) ZOOKEEPER-800 . zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE (michi mutsuzaki via mahadev konar)
        Hide
        Mahadev konar added a comment -

        +1 I just committed this. thanks michi.

        Show
        Mahadev konar added a comment - +1 I just committed this. thanks michi.
        Hide
        Michi Mutsuzaki added a comment -

        I modified zoo_add_auth() in branch-3.3. It returns ZINVALIDSTATE if the connection is in ZOO_CLOSED_STATE state.

        --Michi

        Show
        Michi Mutsuzaki added a comment - I modified zoo_add_auth() in branch-3.3. It returns ZINVALIDSTATE if the connection is in ZOO_CLOSED_STATE state. --Michi
        Hide
        Michi Mutsuzaki added a comment -

        Talked with Mahadev. I'm taking this bug (but don't know how to change assignee in Jira).

        --Michi

        Show
        Michi Mutsuzaki added a comment - Talked with Mahadev. I'm taking this bug (but don't know how to change assignee in Jira). --Michi
        Hide
        Patrick Hunt added a comment -

        penciling in for 3.3.2

        Show
        Patrick Hunt added a comment - penciling in for 3.3.2

          People

          • Assignee:
            Michi Mutsuzaki
            Reporter:
            Michi Mutsuzaki
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development