You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Michi Mutsuzaki (JIRA)" <ji...@apache.org> on 2012/06/04 02:49:22 UTC

[jira] [Created] (ZOOKEEPER-1479) C Client: zoo_add_auth() doesn't wake up the IO thread

Michi Mutsuzaki created ZOOKEEPER-1479:
------------------------------------------

             Summary: C Client: zoo_add_auth() doesn't wake up the IO thread
                 Key: ZOOKEEPER-1479
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1479
             Project: ZooKeeper
          Issue Type: Bug
          Components: c client
    Affects Versions: 3.4.3
            Reporter: Michi Mutsuzaki
             Fix For: 3.5.0


It can take up to sessionTimeout / 3 for the IO thread to send out the auth packet. The {{zoo_add_auth()}} function should call {{adaptor_send_queue(zh, 0)}} after {{calling send_last_auth_info(zh)}}.

--Michi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1479) C Client: zoo_add_auth() doesn't wake up the IO thread

Posted by "Michi Mutsuzaki (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289592#comment-13289592 ] 

Michi Mutsuzaki commented on ZOOKEEPER-1479:
--------------------------------------------

Hi Stephen,

I think it should. As you point out, it doesn't matter if you are calling zoo_add_auth() asynchronously, but it gets annoying when you want to call it synchronously. For example, I was doing something like this in my unit test:

{code}
1. Call zookeeper_init().
2. Wait for the session to become CONNECTED.
3. Call zoo_add_auth().
4. Wait for SUCCESS response.
{code}

and it took me a while to figure out why the test was blocked for 10 seconds in step 4 (I was using 30 second session timeout). 

In general, I think we should wake up the IO thread whenever there is some stuff to send. Do you see any drawbacks in doing that?

Thanks!
--Michi

                
> C Client: zoo_add_auth() doesn't wake up the IO thread
> ------------------------------------------------------
>
>                 Key: ZOOKEEPER-1479
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1479
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.4.3
>            Reporter: Michi Mutsuzaki
>             Fix For: 3.5.0
>
>
> It can take up to sessionTimeout / 3 for the IO thread to send out the auth packet. The {{zoo_add_auth()}} function should call {{adaptor_send_queue(zh, 0)}} after {{calling send_last_auth_info(zh)}}.
> --Michi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1479) C Client: zoo_add_auth() doesn't wake up the IO thread

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289443#comment-13289443 ] 

Stephen Tyree commented on ZOOKEEPER-1479:
------------------------------------------

Should it? Zookeeper operations are well-ordered for one session, so any subsequent operation is going to have the authentication you provide via zoo_add_auth whether or not the I/O thread is woken up.
                
> C Client: zoo_add_auth() doesn't wake up the IO thread
> ------------------------------------------------------
>
>                 Key: ZOOKEEPER-1479
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1479
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.4.3
>            Reporter: Michi Mutsuzaki
>             Fix For: 3.5.0
>
>
> It can take up to sessionTimeout / 3 for the IO thread to send out the auth packet. The {{zoo_add_auth()}} function should call {{adaptor_send_queue(zh, 0)}} after {{calling send_last_auth_info(zh)}}.
> --Michi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1479) C Client: zoo_add_auth() doesn't wake up the IO thread

Posted by "Stephen Tyree (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289643#comment-13289643 ] 

Stephen Tyree commented on ZOOKEEPER-1479:
------------------------------------------

Aside from being used in unit tests, is there a use case for synchronous zoo_add_auth? The downside of this is that anyone using zoo_add_auth for synchronous work does marginally more work than they did before for no benefit, which is something that ideally would be avoided. If this is such an issue for developers (as I could imagine it being), maybe for development builds of Zookeeper there could be a preprocessor flag, say ZOOKEEPER_SYNCHRONOUS_ADD_AUTH, which wakes the IO thread following the call. Then release builds could simply not use the flag, and we end up getting the best of both worlds. 

On the one hand, this is ugly as sin and reeks of leaving printf's throughout your code to aid in debugging. But on the other, this gives the best of both worlds. Thoughts?
                
> C Client: zoo_add_auth() doesn't wake up the IO thread
> ------------------------------------------------------
>
>                 Key: ZOOKEEPER-1479
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1479
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>    Affects Versions: 3.4.3
>            Reporter: Michi Mutsuzaki
>             Fix For: 3.5.0
>
>
> It can take up to sessionTimeout / 3 for the IO thread to send out the auth packet. The {{zoo_add_auth()}} function should call {{adaptor_send_queue(zh, 0)}} after {{calling send_last_auth_info(zh)}}.
> --Michi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira