Possible small bug in Proxy Server example
"이희승 (Trustin Lee)"
trustin at gmail.com
Tue Nov 9 00:43:15 EST 2010
Hi Aaron,
It is guaranteed that setReadable(false) will suspend detection of
channel closure / read errors, so there's no chance of encountering such
bug.
HTH
aaron.riekenberg wrote:
> I think I may have found a small bug in the Proxy Server example code.
>
> Suppose the following sequence of events happens:
>
> 1. A client connects to the proxy, so HexDumpProxyInboundHandler.channelOpen
> is called. channelOpen creates a new outbound channel for the connection
> from the proxy to remote server for the client. It schedules an
> asynchronous connect of the outbound channel to the remote server.
>
> 2. Before the connect of the outbound channel finishes, the client's
> connection to the proxy closes. This causes
> HexDumpProxyInboundHandler.channelClosed to be called. channelClosed calls
> closeOnFlush(outboundChannel). closeOnFlush sees
> outboundChannel.isConnected is false and does nothing.
>
> 3. The connect of the outbound channel finishes, so the anonymous
> ChannelFutureListener.operationComplete is called.
>
> If this sequence can really happen, it would result in an outbound channel
> remaining open from the proxy to the remote server after the client
> disconnected. Nothing would disconnect this channel until the remote server
> decides to close the connection.
>
> I have done some tests, and it seems the call to
> inboundChannel.setReadable(false) in HexDumpProxyInboundHandler.channelOpen
> suspends detection of the inbound channel closing, as well as read
> operations. So I have not been able to make step #2 happen before step #3
> calls inboundChannel.setReadable(true).
>
> Is it guaranteed that setReadable(false) will suspend detection of channel
> closing/errors as well as reads? Or I am I just getting lucky in my tests?
--
Trustin Lee - http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 290 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20101109/40331bb6/attachment.bin
More information about the netty-users
mailing list