You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "im-james (JIRA)" <ji...@apache.org> on 2007/08/14 12:53:30 UTC

[jira] Created: (DIRMINA-419) about the Proxy example

about the Proxy example
-----------------------

                 Key: DIRMINA-419
                 URL: https://issues.apache.org/jira/browse/DIRMINA-419
             Project: MINA
          Issue Type: Bug
          Components: Example
    Affects Versions: 1.1.2
            Reporter: im-james


I've been using the proxy example and I've discovered a bug.

The IOHandler that handles the communication with the server (proxy <---->server) I've found a situation where the handler receives a messageReceived event and then a sessionClosed event in a very short time period. The result is that the bytes received in the proxy are not sent to the client. The connection to the client is closed before the message had a chance to be written.


It is hard to explain the problem so here is a log trace showing what happens when everything goes well:

12:36:05,429 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionOpened
12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageReceived 8
12:36:05,461 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageSent 8
12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionClosed
12:36:05,461 DEBUG [Thread-5] connectionProxy.test.TestClient - client has received the data


And this is a log trace that shows the problem:

12:38:00,554 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionOpened
12:38:00,570 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] messageReceived 8
12:38:00,586 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
12:38:00,586 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionClosed
java.io.EOFException
	at java.io.DataInputStream.readFully(DataInputStream.java:178)
	at java.io.DataInputStream.readLong(DataInputStream.java:380)
	at com.indeos.connectionProxy.test.TestClient.run(TestClient.java:58)
	at java.lang.Thread.run(Thread.java:595)	

The EOFException says that the client has not be able to read the data before the connection was closed.

The conclusion is that the close can happen before the write. Thus to solve the issue I had to add a join() in the messageReceived method such as:

((IoSession) session.getAttachment()).write(wb).join();

Of course with this solution I break the asynchronous nature of the proxy. If you know a better solution I'd like to hear it!


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


[jira] Commented: (DIRMINA-419) about the Proxy example

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683679#action_12683679 ] 

Emmanuel Lecharny commented on DIRMINA-419:
-------------------------------------------

Status with 1.1.7 ?
Last call before I close the issue ...

> about the Proxy example
> -----------------------
>
>                 Key: DIRMINA-419
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-419
>             Project: MINA
>          Issue Type: Bug
>          Components: Example
>    Affects Versions: 1.1.2
>            Reporter: im-james
>
> I've been using the proxy example and I've discovered a bug.
> The IOHandler that handles the communication with the server (proxy <---->server) I've found a situation where the handler receives a messageReceived event and then a sessionClosed event in a very short time period. The result is that the bytes received in the proxy are not sent to the client. The connection to the client is closed before the message had a chance to be written.
> It is hard to explain the problem so here is a log trace showing what happens when everything goes well:
> 12:36:05,429 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionOpened
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageReceived 8
> 12:36:05,461 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionClosed
> 12:36:05,461 DEBUG [Thread-5] connectionProxy.test.TestClient - client has received the data
> And this is a log trace that shows the problem:
> 12:38:00,554 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionOpened
> 12:38:00,570 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] messageReceived 8
> 12:38:00,586 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:38:00,586 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionClosed
> java.io.EOFException
> 	at java.io.DataInputStream.readFully(DataInputStream.java:178)
> 	at java.io.DataInputStream.readLong(DataInputStream.java:380)
> 	at com.indeos.connectionProxy.test.TestClient.run(TestClient.java:58)
> 	at java.lang.Thread.run(Thread.java:595)	
> The EOFException says that the client has not be able to read the data before the connection was closed.
> The conclusion is that the close can happen before the write. Thus to solve the issue I had to add a join() in the messageReceived method such as:
> ((IoSession) session.getAttachment()).write(wb).join();
> Of course with this solution I break the asynchronous nature of the proxy. If you know a better solution I'd like to hear it!

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


[jira] Commented: (DIRMINA-419) about the Proxy example

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649959#action_12649959 ] 

Emmanuel Lecharny commented on DIRMINA-419:
-------------------------------------------

Can you try with version 1.1.7 ? 1.1.2 is very outdated ...

> about the Proxy example
> -----------------------
>
>                 Key: DIRMINA-419
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-419
>             Project: MINA
>          Issue Type: Bug
>          Components: Example
>    Affects Versions: 1.1.2
>            Reporter: im-james
>
> I've been using the proxy example and I've discovered a bug.
> The IOHandler that handles the communication with the server (proxy <---->server) I've found a situation where the handler receives a messageReceived event and then a sessionClosed event in a very short time period. The result is that the bytes received in the proxy are not sent to the client. The connection to the client is closed before the message had a chance to be written.
> It is hard to explain the problem so here is a log trace showing what happens when everything goes well:
> 12:36:05,429 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionOpened
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageReceived 8
> 12:36:05,461 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionClosed
> 12:36:05,461 DEBUG [Thread-5] connectionProxy.test.TestClient - client has received the data
> And this is a log trace that shows the problem:
> 12:38:00,554 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionOpened
> 12:38:00,570 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] messageReceived 8
> 12:38:00,586 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:38:00,586 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionClosed
> java.io.EOFException
> 	at java.io.DataInputStream.readFully(DataInputStream.java:178)
> 	at java.io.DataInputStream.readLong(DataInputStream.java:380)
> 	at com.indeos.connectionProxy.test.TestClient.run(TestClient.java:58)
> 	at java.lang.Thread.run(Thread.java:595)	
> The EOFException says that the client has not be able to read the data before the connection was closed.
> The conclusion is that the close can happen before the write. Thus to solve the issue I had to add a join() in the messageReceived method such as:
> ((IoSession) session.getAttachment()).write(wb).join();
> Of course with this solution I break the asynchronous nature of the proxy. If you know a better solution I'd like to hear it!

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


[jira] Closed: (DIRMINA-419) about the Proxy example

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

Emmanuel Lecharny closed DIRMINA-419.
-------------------------------------

    Resolution: Fixed

2 years old issue, 5 versions ago... Let's close it.

> about the Proxy example
> -----------------------
>
>                 Key: DIRMINA-419
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-419
>             Project: MINA
>          Issue Type: Bug
>          Components: Example
>    Affects Versions: 1.1.2
>            Reporter: im-james
>
> I've been using the proxy example and I've discovered a bug.
> The IOHandler that handles the communication with the server (proxy <---->server) I've found a situation where the handler receives a messageReceived event and then a sessionClosed event in a very short time period. The result is that the bytes received in the proxy are not sent to the client. The connection to the client is closed before the message had a chance to be written.
> It is hard to explain the problem so here is a log trace showing what happens when everything goes well:
> 12:36:05,429 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionOpened
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageReceived 8
> 12:36:05,461 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionClosed
> 12:36:05,461 DEBUG [Thread-5] connectionProxy.test.TestClient - client has received the data
> And this is a log trace that shows the problem:
> 12:38:00,554 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionOpened
> 12:38:00,570 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] messageReceived 8
> 12:38:00,586 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:38:00,586 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionClosed
> java.io.EOFException
> 	at java.io.DataInputStream.readFully(DataInputStream.java:178)
> 	at java.io.DataInputStream.readLong(DataInputStream.java:380)
> 	at com.indeos.connectionProxy.test.TestClient.run(TestClient.java:58)
> 	at java.lang.Thread.run(Thread.java:595)	
> The EOFException says that the client has not be able to read the data before the connection was closed.
> The conclusion is that the close can happen before the write. Thus to solve the issue I had to add a join() in the messageReceived method such as:
> ((IoSession) session.getAttachment()).write(wb).join();
> Of course with this solution I break the asynchronous nature of the proxy. If you know a better solution I'd like to hear it!

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


[jira] Commented: (DIRMINA-419) about the Proxy example

Posted by "im-james (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519643 ] 

im-james commented on DIRMINA-419:
----------------------------------

I've just noticed that in the example, the AbstractProxyIoHandler.sessionClosed() method closes only one connection. In my code I close both connections. I don't know if the connection is purposfully let opened but the outcome described in this issue is still the same.
 


> about the Proxy example
> -----------------------
>
>                 Key: DIRMINA-419
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-419
>             Project: MINA
>          Issue Type: Bug
>          Components: Example
>    Affects Versions: 1.1.2
>            Reporter: im-james
>
> I've been using the proxy example and I've discovered a bug.
> The IOHandler that handles the communication with the server (proxy <---->server) I've found a situation where the handler receives a messageReceived event and then a sessionClosed event in a very short time period. The result is that the bytes received in the proxy are not sent to the client. The connection to the client is closed before the message had a chance to be written.
> It is hard to explain the problem so here is a log trace showing what happens when everything goes well:
> 12:36:05,429 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionOpened
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageReceived 8
> 12:36:05,461 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] messageSent 8
> 12:36:05,461 DEBUG [AnonymousIoService-7] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:36:05,461 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14784] sessionClosed
> 12:36:05,461 DEBUG [Thread-5] connectionProxy.test.TestClient - client has received the data
> And this is a log trace that shows the problem:
> 12:38:00,554 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionOpened
> 12:38:00,570 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] messageReceived 8
> 12:38:00,586 DEBUG [Thread-1] connectionProxy.test.TestAppServer - server has received and sent data back
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageSent 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] messageReceived 8
> 12:38:00,586 DEBUG [AnonymousIoService-12] connectionProxy.ServerToProxyIoHandler - [/127.0.0.1:80] sessionClosed   0
> 12:38:00,586 DEBUG [SocketAcceptorIoProcessor-0.0] connectionProxy.ClientToProxyIoHandler - [/127.0.0.1:14904] sessionClosed
> java.io.EOFException
> 	at java.io.DataInputStream.readFully(DataInputStream.java:178)
> 	at java.io.DataInputStream.readLong(DataInputStream.java:380)
> 	at com.indeos.connectionProxy.test.TestClient.run(TestClient.java:58)
> 	at java.lang.Thread.run(Thread.java:595)	
> The EOFException says that the client has not be able to read the data before the connection was closed.
> The conclusion is that the close can happen before the write. Thus to solve the issue I had to add a join() in the messageReceived method such as:
> ((IoSession) session.getAttachment()).write(wb).join();
> Of course with this solution I break the asynchronous nature of the proxy. If you know a better solution I'd like to hear it!

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