[
https://issues.apache.org/jira/browse/ZOOKEEPER-1105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295516#comment-13295516
]
lincoln.lee commented on ZOOKEEPER-1105:
----------------------------------------
Diego, I've also encountered java.nio.channels.CancelledKeyException in
server's log when a python client calls close method, but I found client had
sent CLOSE_OP request to server but exit before server can read the request
completely,
src/c/src/zookeeper.c
@@ -2522,6 +2522,22 @@
/* 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); // here actually call send(s, buf, len,
MSG_NOSIGNAL)
we can simply sleep one second after call send_buffer in flush_send_queue
method of src/c/src/zookeeper.c
rc = send_buffer(zh->fd, zh->to_send.head);
+ if (timeout>0)sleep(1);
if(rc==0 && timeout==0){
or add a little more lines as the ZOOKEEPER-1105.patch attached (against trunk)
> c client zookeeper_close not send CLOSE_OP request to server
> ------------------------------------------------------------
>
> Key: ZOOKEEPER-1105
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1105
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.3.2
> Reporter: jiang guangran
> Assignee: Patrick Hunt
> Attachments: ZOOKEEPER-1105.patch, zklog.txt, zktest.c, zktest.java
>
>
> in zookeeper_close function, do adaptor_finish before send CLOSE_OP request
> to server
> so the CLOSE_OP request can not be sent to server
> in server zookeeper.log have many
> 2011-06-22 00:23:02,323 - WARN
> [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@634] -
> EndOfStreamException: Unable to read additional data from client sessionid
> 0x1305970d66d2224, likely client has closed socket
> 2011-06-22 00:23:02,324 - INFO
> [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1435] - Closed
> socket connection for client /10.250.8.123:60257 which had sessionid
> 0x1305970d66d2224
> 2011-06-22 00:23:02,325 - ERROR [CommitProcessor:1:NIOServerCnxn@445] -
> Unexpected Exception:
> java.nio.channels.CancelledKeyException
> at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
> at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:59)
> at
> org.apache.zookeeper.server.NIOServerCnxn.sendBuffer(NIOServerCnxn.java:418)
> at
> org.apache.zookeeper.server.NIOServerCnxn.sendResponse(NIOServerCnxn.java:1509)
> at
> org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:367)
> at
> org.apache.zookeeper.server.quorum.CommitProcessor.run(CommitProcessor.java:73)
> and java client not have this problem
--
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