Random connect exceptions

Christian Migowski chrismfwrd at gmail.com
Tue Nov 3 06:41:26 EST 2009


Hi Shay,

the code looks OK, but two things:

1) did you set the connectTimeout to the bootstrap, i.e.

 clientBootstrap.setOption("connectTimeoutMillis",connectTimeout.millis());

if no that might be the reason: the connection attempt is just not finished yet

2) if yes do you use the latest Netty version? The NIO transport in
versions prior to 3.1.4 (if i remember correctly) did not respect the
connect timeout.

hth,
regards,
christian!


On Tue, Nov 3, 2009 at 12:19 PM, Shay Banon <kimchy at gmail.com> wrote:
> Hi,
>
>  I am getting random connect failures when using netty, which I am
> trying to track down the cause of it. First, here is the code I use to
> connect:
>
>            InetSocketAddress address = // obtain the address to connect to
>            ChannelFuture channelFuture = clientBootstrap.connect(address);
>            channelFuture.awaitUninterruptibly(connectTimeout.millis());
> // connect timeout is 1 second
>            if (!channelFuture.isSuccess()) {
>                throw new ConnectTransportException(address, "",
> channelFuture.getCause());
>            }
>
>
> First, is this code fragment correct, or am I missing something?
> Second, the strange thing I get is that the channelFuture.getCause()
> is null .., so I don't really know the underlying problem here.
>
> Any idea?
>
> Cheers,
> Shay
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



More information about the netty-users mailing list