[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14746057#comment-14746057
 ] 

Powell Molleti commented on ZOOKEEPER-2246:
-------------------------------------------

Hi Akihiro,

Thanks for looking at the patch. Reading up on SocketChannel and 
InputStream/OutputStream you are correct about better interrupt-ability of 
SocketChannel while performing read/write operations.

However looking at the code of RecvWorker/SendWorker/Listener and Halt() in QCM 
class it seems like CloseSocket() is called for all paths before calling 
thread.interrupt(). And since both read() and write() operations throw 
IOException when socket is already closed I think a blocking read() should 
throw an exception if socket is closed. Hence the shutdown of these threads 
seems safe as far finish() , halt() code paths are concerned. 

I tried to look at logs from 
[ZOOKEEPER-2080|https://issues.apache.org/jira/browse/ZOOKEEPER-2080] and I am 
unable to reach any conclusion on using SocketChannel could solve the problem 
or that is even the root cause of that issue. I will continue to look at it 
more closely.

I can however modify the patch to use SocketChannel instead of 
InputStream/OutputStream and perhaps you can help try to reproduce it with 
that?.

Let me know.
thanks
Powell.

> quorum connection manager takes a long time to shut down
> --------------------------------------------------------
>
>                 Key: ZOOKEEPER-2246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2246
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum
>            Reporter: Michi Mutsuzaki
>             Fix For: 3.5.2, 3.6.0
>
>         Attachments: 
> 0001-ZOOKEEPER-2246-quorum-connection-manager-takes-a-lon.patch
>
>
> Receive worker can take a long time to shut down because the socket timeout 
> is set to zero: http://s.apache.org/TfI
> There was a discussion on the mailing list a while back: 
> http://s.apache.org/cYG



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to