[ 
https://issues.apache.org/jira/browse/HADOOP-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572780#action_12572780
 ] 

Tsz Wo (Nicholas), SZE commented on HADOOP-2346:
------------------------------------------------

The ideas are really good.  Not able to finish reading the patch yet.  Got some 
comments:
- SocketIOWithTimeout.read is not needed.  It might be a local variable in 
doIO(ByteBuffer buf), i.e.
{code}
synchronized int doIO(ByteBuffer buf) throws IOException {
  boolean read = channel instanceof ReadableByteChannel;
  ...
}
{code}

- The class SocketIOWithTimeout serves both ReadableByteChannel and 
WritableByteChannel.  It might be better to make SocketIOWithTimeout abstract 
and create two sub-classes for ReadableByteChannel and WritableByteChannel.  
Then, the runtime checking can be eliminated

- SocketIOWithTimeout.isClosed() should check channel.isOpen() and update 
SocketIOWithTimeout.closed if necessary.  Then SocketInputStream.isOpen() 
should just return !socketIO.isClosed().

- Instead of implementing a linked list by ProviderInfo.next, it is better to 
use a list class provided in java.util.

> DataNode should have timeout on socket writes.
> ----------------------------------------------
>
>                 Key: HADOOP-2346
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2346
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: dfs
>    Affects Versions: 0.15.1
>            Reporter: Raghu Angadi
>            Assignee: Raghu Angadi
>             Fix For: 0.17.0
>
>         Attachments: HADOOP-2346.patch, HADOOP-2346.patch, HADOOP-2346.patch, 
> HADOOP-2346.patch, HADOOP-2346.patch, HADOOP-2346.patch, HADOOP-2346.patch, 
> HADOOP-2346.patch, HADOOP-2346.patch, HADOOP-2346.patch
>
>
> If a client opens a file and stops reading in the middle, DataNode thread 
> writing the data could be stuck forever. For DataNode sockets we set read 
> timeout but not write timeout. I think we should add a write(data, timeout) 
> method in IOUtils that assumes it the underlying FileChannel is non-blocking.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to