vert.x
vert.x copied to clipboard
httpclient connectTimeout does not work expected
Questions
httpclient sets connecttimeout
, when the connection fails (possibly due to network jitter or upstream performance issues), the duration of connect failed callback may be less than the connecttimeout
.
CircuitBreaker '****' recorded an error: 'io.netty.channel.ConnectTimeoutException: connection timed out: */'. Elapsed time: 1 ms io.netty.channel.ConnectTimeoutException: connection timed out: ** at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:267) at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:127) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)
Version
3.6.x - 3.9.x
Do you have a reproducer?
https://gist.github.com/jinwik/569938388962a457a93ee87d9b9c6732
update the reproducer
+1 for this issue, we're reproducing this more in Microsoft Azure cloud and less in AWS. We configured the timeout to be at 10 seconds and we get the error after 200/300ms sometimes. Thanks.
can you elaborate more precisely what the issue is ?
vertx httpclient or webclient sets the connection timeout, for example 5 seconds, sometimes it failed and throws io.netty.channel.ConnectTimeoutException but the whole request time is much less than the configured value, for example 1ms, it is so weird.
I'm seeing this as well with setConnectTimeout(2000)
and actual timeouts sometimes taking less than 300ms.
I think in 4.1 we should add a connection acquisition timeout and have the global timeout only for the HTTP request operation, now this is possible with the new pool implementation.
I am not able to reproduce this with this reproducer locally, can you check this still applies with latest vertx 4?
other than that, it seems to be a netty issue