Read timeout errors in infinite loop

Marc-André Laverdière marcandre.laverdiere at gmail.com
Tue Aug 24 00:26:01 EDT 2010


Hi. One way I deal with this is with an AtomicBoolean flag that knows if the
task is being processed. If true, then I don't disconnect the channel.

On 20 Aug 2010 19:44, "javadevmtl" <java.dev.mtl at gmail.com> wrote:


I redid my stress test this time I added back the ReadTimeoutHandler but I'm
no longer dynamically removing it from the pipeline like I was doing before.
This time everything worked fine.

It's just a matter of understanding how it works and how it can be used...
My issue with the timer is the following or at least this is how I think it
works...

The moment the client connects the timer starts counting until "some"
packets come in. Once a couple of packets come in the timer is reset and
counts again. If I set the read timeout to say 3 seconds that means that
there will be a ReadTimeoutException thrown every 3 seconds. Sometimes my
business logic takes longer then 3 seconds to execute since it connects to
DB and other 3rd parties. So if it takes longer then 3 seconds I don't want
to timeout the client. Currently on ReadTimeOutException I close the socket.

So I figure what I can do is just set a higher read time out value like say
10 seconds and I'm ok. Like this I can also handle clients that potentially
don't send the "right" protocol/message to the server and I can clean them
up.
--
View this message in context:
http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Read-timeout-errors-in-infinite-loop-tp5440336p5444648.html

Sent from the Netty User Group mailing list archive at Nabble.com.
_________________________________...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20100824/a2a065ea/attachment.html 


More information about the netty-users mailing list