You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "xiliu (JIRA)" <ji...@apache.org> on 2011/06/29 07:31:28 UTC
[jira] [Created] (ZOOKEEPER-1110) c interface zookeeper_close close
fd too quickly.
c interface zookeeper_close close fd too quickly.
-------------------------------------------------
Key: ZOOKEEPER-1110
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
Project: ZooKeeper
Issue Type: Bug
Components: c client
Affects Versions: 3.3.3
Environment: linux platform.
Reporter: xiliu
Fix For: 3.3.4
The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
The right order is first send the request then wait the timeout. I change as follow:
$svn diff src/c/src/zookeeper.c
Index: src/c/src/zookeeper.c
===================================================================
--- src/c/src/zookeeper.c (revision 1140451)
+++ src/c/src/zookeeper.c (working copy)
@@ -2329,7 +2329,8 @@
/* make sure the close request is sent; we set timeout to an arbitrary
* (but reasonable) number of milliseconds since we want the call to block*/
- rc=adaptor_send_queue(zh, 3000);
+ rc=adaptor_send_queue(zh, 0);
+ sleep(3);
}else{
LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
zh->client_id.client_id));
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (ZOOKEEPER-1110) c interface zookeeper_close close
fd too quickly.
Posted by "Patrick Hunt (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Hunt updated ZOOKEEPER-1110:
------------------------------------
Fix Version/s: (was: 3.3.5)
3.3.6
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Fix For: 3.3.6
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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] [Resolved] (ZOOKEEPER-1110) c interface zookeeper_close
close fd too quickly.
Posted by "Michi Mutsuzaki (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michi Mutsuzaki resolved ZOOKEEPER-1110.
----------------------------------------
Resolution: Invalid
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Fix For: 3.3.6
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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] [Updated] (ZOOKEEPER-1110) c interface zookeeper_close close
fd too quickly.
Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Hunt updated ZOOKEEPER-1110:
------------------------------------
Fix Version/s: (was: 3.3.6)
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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-1110) c interface zookeeper_close
close fd too quickly.
Posted by "Tang Xi Liu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261355#comment-13261355 ]
Tang Xi Liu commented on ZOOKEEPER-1110:
----------------------------------------
please do as you wish.
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Fix For: 3.3.6
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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] [Updated] (ZOOKEEPER-1110) c interface zookeeper_close close
fd too quickly.
Posted by "Patrick Hunt (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Hunt updated ZOOKEEPER-1110:
------------------------------------
Fix Version/s: (was: 3.3.4)
3.3.5
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Fix For: 3.3.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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-1110) c interface zookeeper_close
close fd too quickly.
Posted by "Michi Mutsuzaki (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261350#comment-13261350 ]
Michi Mutsuzaki commented on ZOOKEEPER-1110:
--------------------------------------------
Hi xiliu,
Sorry it took this long to respond!
I don't think this is a valid bug. The intention of the original code is to wait for the fd to become writable for a given amount of time, which I think is the right thing to do. This patch will make zookeeper_close() nonblocking; if the fd is not writable, it'll simply return ZOK without actually sending the request. That's not what we want to do.
Let me know if I misunderstood your bug report. Otherwise, I'll close this ticket as invalid.
Thanks!
--Michi
> c interface zookeeper_close close fd too quickly.
> -------------------------------------------------
>
> Key: ZOOKEEPER-1110
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1110
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.3
> Environment: linux platform.
> Reporter: xiliu
> Fix For: 3.3.6
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The correct step about close client is the client send CLOSE_OP to the server, wait for several seconds, the server will process the terminal request and close the fd.
> But the zookeeper_close interface is wrong, because the adaptor_send_queue(zh, 3000) (line 2332), will first wait the timeout then send the request.
> The right order is first send the request then wait the timeout. I change as follow:
> $svn diff src/c/src/zookeeper.c
> Index: src/c/src/zookeeper.c
> ===================================================================
> --- src/c/src/zookeeper.c (revision 1140451)
> +++ src/c/src/zookeeper.c (working copy)
> @@ -2329,7 +2329,8 @@
> /* make sure the close request is sent; we set timeout to an arbitrary
> * (but reasonable) number of milliseconds since we want the call to block*/
> - rc=adaptor_send_queue(zh, 3000);
> + rc=adaptor_send_queue(zh, 0);
> + sleep(3);
> }else{
> LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
> zh->client_id.client_id));
>
--
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