Random connect exceptions

Trustin Lee (이희승) trustin at gmail.com
Sun Nov 8 04:22:40 EST 2009


Perhaps it might be a bug.  I will investigate a little bit more.
Could you paste the whole bootstrap initialization and connection
attempt code?

Thanks

— Trustin Lee, http://gleamynode.net/



On Sun, Nov 8, 2009 at 5:38 PM, Shay Banon <kimchy at gmail.com> wrote:
> I see. Now, when I try with waiting without any timeout value
> (channelFuture.awaitUninterruptibly()), then it simply hangs without
> returning. I do set the connectionTimeoutMillis... :
>
> clientBootstrap.setOption("connectTimeoutMillis", connectTimeout.millis());
>
> and it is set to 1 second.
>
> Cheers,
> Shay
>
> On Sat, Nov 7, 2009 at 5:09 PM, Trustin Lee (이희승) <trustin at gmail.com> wrote:
>> If you have specified connectTimeoutMillis option correctly, you
>> should not specify the timeout value when you call
>> ChannelFuture.await().  ChannelFuture will complete automatically on
>> connection timeout.
>>
>> You cannot assume that the connection attempt has failed if
>> ChannelFuture.isSuccess() returned false because it might also mean
>> that the connection attempt is still in progress.  To make sure that
>> the connection attempt is finished, you have to await the future until
>> its completion.  If ChannelFuture is complete, ChannelFuture.isDone()
>> returns true.
>>
>> HTH
>>
>> — Trustin Lee, http://gleamynode.net/
>>
>>
>>
>> On Tue, Nov 3, 2009 at 11:49 PM, Shay Banon <kimchy at gmail.com> wrote:
>>> Hi,
>>>
>>>  First of all, thanks for the reply. I have added the connectTimeout
>>> option as you suggested, and it does not seem to help. Even when I set
>>> it to a higher value, it simply waits there until the timeout passed,
>>> and then the channelFuture#isSuccess is false. I still don't get the
>>> actual cause as well. I am using netty version 3.1.5.
>>>
>>>  What is the scenario that the cause of the future is null?
>>>
>>> Thanks,
>>> Shay
>>>
>>> On Tue, Nov 3, 2009 at 1:41 PM, Christian Migowski <chrismfwrd at gmail.com> wrote:
>>>> 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
>>>>>
>>>>
>>>> _______________________________________________
>>>> netty-users mailing list
>>>> netty-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>>
>>>
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>
> _______________________________________________
> 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