You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Newcomb, Michael-P57487" <Mi...@gdc4s.com> on 2007/02/27 15:26:34 UTC

A problem and a few questions...

Problem:

I have a basic client/server setup. The client sends a message to the
server. The server processes this message and sends some messages back
to the client. I have the logging filter installed so I see the WRITE:
message, SENT: message pattern in my logs.

So, after a while, as the server sends responses to the client, I see
the WRITE: message, but I never see the corresponding SENT: message in
the log. The client does in fact receive all the messages, but as the
client trys to send more messages to the server (I see WRITE: and SENT:
on the client), the server no longer gets any RECEIVE: message from that
particular client.

So, my basic questions would be:

1. What would cause messages sent to a client to be written
successfully, but never receive a 'sent' confirmation?
2. Why would I stop receiving messages from a client?

I'm sure it is something I've done recently because it was working fine,
but I'm a little lost as to why this is happening now.

Thanks,
Michael

Re: A problem and a few questions...

Posted by Marcin Waldowski <M....@sulechow.net>.
Hello.

I think you should disconnect client, for which server is not able to 
send message for some time.

You can use setWriteTimeout(int seconds), to detect such connections:

public void sessionCreated(IoSession session) throws Exception {
    session.setWriteTimeout(10);
}

and then catch Exception and close connection

public void exceptionCaught(IoSession session, Throwable cause) throws 
Exception {
    if(cause instanceof WriteTimeoutException) {
       session.close();
    }
}

I bet that this is not because of Mina but underlying operating system. 
Look at code bellow:
http://weblogs.java.net/blog/jfarcand/archive/2006/05/tricks_and_tips_1.html

In that code when some attempts to write fail, a following exception is 
thrown:

throw new IOException("Client disconnected");


Newcomb, Michael-P57487 wrote:
> Problem:
>
> I have a basic client/server setup. The client sends a message to the
> server. The server processes this message and sends some messages back
> to the client. I have the logging filter installed so I see the WRITE:
> message, SENT: message pattern in my logs.
>
> So, after a while, as the server sends responses to the client, I see
> the WRITE: message, but I never see the corresponding SENT: message in
> the log. The client does in fact receive all the messages, but as the
> client trys to send more messages to the server (I see WRITE: and SENT:
> on the client), the server no longer gets any RECEIVE: message from that
> particular client.
>
> So, my basic questions would be:
>
> 1. What would cause messages sent to a client to be written
> successfully, but never receive a 'sent' confirmation?
> 2. Why would I stop receiving messages from a client?
>
> I'm sure it is something I've done recently because it was working fine,
> but I'm a little lost as to why this is happening now.
>
> Thanks,
> Michael
>
>   


RE: A problem and a few questions...

Posted by "Newcomb, Michael-P57487" <Mi...@gdc4s.com>.
Correct answer:

nextFilter.filterWrite(session, new WriteRequest(newObject,
oldWriteRequest.getFuture()));

Sorry for all the traffic!

-----Original Message-----
From: Newcomb, Michael-P57487 [mailto:Michael.Newcomb@gdc4s.com] 
Sent: Tuesday, February 27, 2007 10:44 AM
To: dev@mina.apache.org
Subject: RE: A problem and a few questions...

The problem was that I was replacing the WriteRequest in my filter with
a new one.

Don't do:

nextFilter.filterWrite(session, new WriteRequest(newObject));

Question is, how do I change the object that is being written?

Thanks,
Michael 

-----Original Message-----
From: Newcomb, Michael-P57487 [mailto:Michael.Newcomb@gdc4s.com]
Sent: Tuesday, February 27, 2007 9:27 AM
To: dev@mina.apache.org
Subject: A problem and a few questions...

Problem:

I have a basic client/server setup. The client sends a message to the
server. The server processes this message and sends some messages back
to the client. I have the logging filter installed so I see the WRITE:
message, SENT: message pattern in my logs.

So, after a while, as the server sends responses to the client, I see
the WRITE: message, but I never see the corresponding SENT: message in
the log. The client does in fact receive all the messages, but as the
client trys to send more messages to the server (I see WRITE: and SENT:
on the client), the server no longer gets any RECEIVE: message from that
particular client.

So, my basic questions would be:

1. What would cause messages sent to a client to be written
successfully, but never receive a 'sent' confirmation?
2. Why would I stop receiving messages from a client?

I'm sure it is something I've done recently because it was working fine,
but I'm a little lost as to why this is happening now.

Thanks,
Michael

RE: A problem and a few questions...

Posted by "Newcomb, Michael-P57487" <Mi...@gdc4s.com>.
The problem was that I was replacing the WriteRequest in my filter with
a new one.

Don't do:

nextFilter.filterWrite(session, new WriteRequest(newObject));

Question is, how do I change the object that is being written?

Thanks,
Michael 

-----Original Message-----
From: Newcomb, Michael-P57487 [mailto:Michael.Newcomb@gdc4s.com] 
Sent: Tuesday, February 27, 2007 9:27 AM
To: dev@mina.apache.org
Subject: A problem and a few questions...

Problem:

I have a basic client/server setup. The client sends a message to the
server. The server processes this message and sends some messages back
to the client. I have the logging filter installed so I see the WRITE:
message, SENT: message pattern in my logs.

So, after a while, as the server sends responses to the client, I see
the WRITE: message, but I never see the corresponding SENT: message in
the log. The client does in fact receive all the messages, but as the
client trys to send more messages to the server (I see WRITE: and SENT:
on the client), the server no longer gets any RECEIVE: message from that
particular client.

So, my basic questions would be:

1. What would cause messages sent to a client to be written
successfully, but never receive a 'sent' confirmation?
2. Why would I stop receiving messages from a client?

I'm sure it is something I've done recently because it was working fine,
but I'm a little lost as to why this is happening now.

Thanks,
Michael