You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Amol Nayak (JIRA)" <ji...@apache.org> on 2011/01/02 15:16:46 UTC

[jira] Created: (DIRMINA-814) Slow Receivers cannot read already read data by client connection close initiated by client

Slow Receivers cannot read already read data by client connection close initiated by client
-------------------------------------------------------------------------------------------

                 Key: DIRMINA-814
                 URL: https://issues.apache.org/jira/browse/DIRMINA-814
             Project: MINA
          Issue Type: Bug
          Components: Core
         Environment: Windows Vista
            Reporter: Amol Nayak
             Fix For: 2.0.3


A simple MINA server is developed which is simulating a slow server, the read is done after a sleep of 10 ms.
A clients writes a huge chunk of bytes and closes the connection.
This close denies a read to the stream from the client and the data already sent to server is not available for read.
A more reasonable behavior is to disallow writes but allow the server  to read at least what is being already published to the server.

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


[jira] Updated: (DIRMINA-814) Slow Receivers cannot read already read data by client connection close initiated by client

Posted by "Amol Nayak (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amol Nayak updated DIRMINA-814:
-------------------------------

    Attachment: Toronto.txt
                SimpleMINAServerClient.java
                Mina20Server.java

Attached the Sample Server and Client program.
Do the below steps to simulate the issue

1. Start the server (Source attached).
2. Place the attached ".txt" file in the etc directory relative to client application
3. Execute the client application
4. See the result on the server's console.  
5. The file is entirely written but all reads by the server after client closes the connection return -1 and the data is not available to the server


> Slow Receivers cannot read already read data by client connection close initiated by client
> -------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-814
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-814
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: Windows Vista
>            Reporter: Amol Nayak
>             Fix For: 2.0.3
>
>         Attachments: Mina20Server.java, SimpleMINAServerClient.java, Toronto.txt
>
>
> A simple MINA server is developed which is simulating a slow server, the read is done after a sleep of 10 ms.
> A clients writes a huge chunk of bytes and closes the connection.
> This close denies a read to the stream from the client and the data already sent to server is not available for read.
> A more reasonable behavior is to disallow writes but allow the server  to read at least what is being already published to the server.

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


[jira] Updated: (DIRMINA-814) Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client

Posted by "Amol Nayak (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amol Nayak updated DIRMINA-814:
-------------------------------


Couple of things.
1. The Sample I gave is just to explain crux of the issue, i have a requirement where the number of bytes received is huge and will be sent continuously by the client and hence i dont want to read the bytes using the above approach (using theIOBuffer's .array() method).
2. When I write a server using Java NIO or using conventional socket programming API (from java.net package) i dont see this behaviour and the data is available to be read even after the client closes the connection and hence I expect a similar behaviour.

The behaviour i feel is on close the stream can set the internal flag indicating it to be closed for more data coming in but the internal buffers should be released only after there is no data to be read from the stream (data that is already written).

> Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-814
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-814
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: Windows Vista
>            Reporter: Amol Nayak
>             Fix For: 2.0.3
>
>         Attachments: Mina20Server.java, SimpleMINAServerClient.java, Toronto.txt
>
>
> A simple MINA server is developed which is simulating a slow server, the read is done after a sleep of 10 ms.
> A clients writes a huge chunk of bytes and closes the connection.
> This close denies a read to the stream from the client and the data already sent to server is not available for read.
> A more reasonable behavior is to disallow writes but allow the server  to read at least what is being already published to the server.

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


[jira] Resolved: (DIRMINA-814) Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRMINA-814.
---------------------------------------

    Resolution: Won't Fix

This behavior is completly normal : as the stream processing is done in a separate thread, it's very likely that the close event is processed before the remaining bytes are being processed. 

If you transform your server to be :

...
class ClientConnectionHandler extends IoHandlerAdapter {

    public void messageReceived( IoSession session, Object message )
    {
        String str = new String( ((IoBuffer) message).array() );
        System.out.println(str);
    }
}

you'll get the entire text dumped in the console.

> Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-814
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-814
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: Windows Vista
>            Reporter: Amol Nayak
>             Fix For: 2.0.3
>
>         Attachments: Mina20Server.java, SimpleMINAServerClient.java, Toronto.txt
>
>
> A simple MINA server is developed which is simulating a slow server, the read is done after a sleep of 10 ms.
> A clients writes a huge chunk of bytes and closes the connection.
> This close denies a read to the stream from the client and the data already sent to server is not available for read.
> A more reasonable behavior is to disallow writes but allow the server  to read at least what is being already published to the server.

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


[jira] Updated: (DIRMINA-814) Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client

Posted by "Amol Nayak (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amol Nayak updated DIRMINA-814:
-------------------------------

    Summary: Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client  (was: Slow Receivers cannot read already read data by client connection close initiated by client)

> Slow Receivers(servers) cannot read data already written by client applications after connection close is initiated by client
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-814
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-814
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: Windows Vista
>            Reporter: Amol Nayak
>             Fix For: 2.0.3
>
>         Attachments: Mina20Server.java, SimpleMINAServerClient.java, Toronto.txt
>
>
> A simple MINA server is developed which is simulating a slow server, the read is done after a sleep of 10 ms.
> A clients writes a huge chunk of bytes and closes the connection.
> This close denies a read to the stream from the client and the data already sent to server is not available for read.
> A more reasonable behavior is to disallow writes but allow the server  to read at least what is being already published to the server.

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