Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
3.3.3
-
None
-
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.