You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "xieyufeng (JIRA)" <ji...@apache.org> on 2012/11/21 10:21:58 UTC

[jira] [Created] (DIRMINA-917) IoHandlerAdapter.sessionClosed is not call when the clien close a connection

xieyufeng created DIRMINA-917:
---------------------------------

             Summary: IoHandlerAdapter.sessionClosed is not call when the clien close a connection
                 Key: DIRMINA-917
                 URL: https://issues.apache.org/jira/browse/DIRMINA-917
             Project: MINA
          Issue Type: Bug
          Components: Handler
    Affects Versions: 2.0.3
         Environment: OS:Debian 2.6.32-41
MINA Version:2.0.3
            Reporter: xieyufeng
            Priority: Critical


My Client Code:
public static void main(String[] args) throws Exception {
		Socket[] sockets = new Socket[100];
		try {
			for (int i = 0; i < 100; i++) {
				// sockets[i]=new Socket(args[0], Integer.parseInt(args[1]));
				sockets[i] = new Socket("*.*.*.*", 8282);
				try {
					Thread.sleep(1);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		while (true) {
			try {
				Thread.sleep(100000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
	}

where the 100 connection finished,"sessionCreated(IoSession session)" called 100 times(It's OK),Then I kill the client process.I found" sessionClosed(IoSession session)" only called 33 times,"exceptionCaught(IoSession session, Throwable cause) " called 65 times.So I suggest “sessionClosed” is not called every time . 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (DIRMINA-917) IoHandlerAdapter.sessionClosed is not call when the clien close a connection

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

Emmanuel Lecharny resolved DIRMINA-917.
---------------------------------------

    Resolution: Not A Problem

This is plain normal. If you brutally kill your process, or unplug your network cable, the server won't be informed that the client has been disconnected.

If you want the server to be informed that the clients are disconnected, then the clients have to safely close the sockets they are using. 

Note this is not specific to MINA : it's exactly the same problem in C or any other language.


                
> IoHandlerAdapter.sessionClosed is not call when the clien close a connection
> ----------------------------------------------------------------------------
>
>                 Key: DIRMINA-917
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-917
>             Project: MINA
>          Issue Type: Bug
>          Components: Handler
>    Affects Versions: 2.0.3
>         Environment: OS:Debian 2.6.32-41
> MINA Version:2.0.3
>            Reporter: xieyufeng
>            Priority: Critical
>
> My Client Code:
> public static void main(String[] args) throws Exception {
> 		Socket[] sockets = new Socket[100];
> 		try {
> 			for (int i = 0; i < 100; i++) {
> 				// sockets[i]=new Socket(args[0], Integer.parseInt(args[1]));
> 				sockets[i] = new Socket("*.*.*.*", 8282);
> 				try {
> 					Thread.sleep(1);
> 				} catch (InterruptedException e) {
> 					e.printStackTrace();
> 				}
> 			}
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 		while (true) {
> 			try {
> 				Thread.sleep(100000);
> 			} catch (InterruptedException e) {
> 				// TODO Auto-generated catch block
> 				e.printStackTrace();
> 			}
> 		}
> 	}
> where the 100 connection finished,"sessionCreated(IoSession session)" called 100 times(It's OK),Then I kill the client process.I found" sessionClosed(IoSession session)" only called 33 times,"exceptionCaught(IoSession session, Throwable cause) " called 65 times.So I suggest “sessionClosed” is not called every time . 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira