[ 
https://issues.apache.org/jira/browse/IGNITE-15867?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ilya Korol updated IGNITE-15867:
--------------------------------
    Description: 
After fixing IGNITE-15367 calling 
{{GridNioServer$AbstractNioClientWorker.closekey(SelectionKey key)}} would 
produce excessive {{java.nio.channels.ClosedChannelException}} because 
{{sock.shutdownInput()}} and {{sock.shutdownInput()}} would be called twice:


{code:java}
// GridNioServer$AbstractNioClientWorker

private void closeKey(SelectionKey key) {
    // Shutdown input and output so that remote client will see correct socket 
close.
    Socket sock = ((SocketChannel)key.channel()).socket();

    try {
        try {
            sock.shutdownInput();            // <-- First time
        }
        catch (IOException ignored) {
            // No-op.
        }

        try {
            sock.shutdownOutput();         // <-- First time
        }
        catch (IOException ignored) {
            // No-op.
        }
    }
    finally {
        U.close(key, log);                       // <-- Second time
        U.close(sock, log);                     // <-- Second time
    }
}
{code}



  was:
After fixing IGNITE-15367 calling 
GridNioServer$AbstractNioClientWorker.closekey(SelectionKey key) would produce 
excessive java.nio.channels.ClosedChannelException because sock.shutdownInput() 
would be called twice:



> Socket shutdown called twice in GridNioServer
> ---------------------------------------------
>
>                 Key: IGNITE-15867
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15867
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.11
>            Reporter: Ilya Korol
>            Priority: Major
>
> After fixing IGNITE-15367 calling 
> {{GridNioServer$AbstractNioClientWorker.closekey(SelectionKey key)}} would 
> produce excessive {{java.nio.channels.ClosedChannelException}} because 
> {{sock.shutdownInput()}} and {{sock.shutdownInput()}} would be called twice:
> {code:java}
> // GridNioServer$AbstractNioClientWorker
> private void closeKey(SelectionKey key) {
>     // Shutdown input and output so that remote client will see correct 
> socket close.
>     Socket sock = ((SocketChannel)key.channel()).socket();
>     try {
>         try {
>             sock.shutdownInput();            // <-- First time
>         }
>         catch (IOException ignored) {
>             // No-op.
>         }
>         try {
>             sock.shutdownOutput();         // <-- First time
>         }
>         catch (IOException ignored) {
>             // No-op.
>         }
>     }
>     finally {
>         U.close(key, log);                       // <-- Second time
>         U.close(sock, log);                     // <-- Second time
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to