[
https://issues.apache.org/jira/browse/ZOOKEEPER-800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054105#comment-13054105
]
Dheeraj Agrawal commented on ZOOKEEPER-800:
-------------------------------------------
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.
> zoo_add_auth returns ZOK if zookeeper handle is in ZOO_CLOSED_STATE
> -------------------------------------------------------------------
>
> Key: ZOOKEEPER-800
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-800
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.1
> Reporter: Michi Mutsuzaki
> Assignee: Michi Mutsuzaki
> Priority: Minor
> Fix For: 3.3.2, 3.4.0
>
> Attachments: ZOOKEEPER-800.patch
>
>
> 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
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira