Description
Describe the bug
I am testing behavior of the Fabric8 SharedIndexInformer during having network instability. I am trying to determine whether it is going to fail or recover when a connection is lost so that I could handle this scenario as neeeded. I ran kubectl proxy
to control connectivity, so my master URL is http://127.0.0.1:8001.
try (SharedIndexInformer informer = client.pods() .inNamespace("$NAMESPACE") .withName("$POD_NAME") .runnableInformer(0L)) { informer.addEventHandler(...); informer.exceptionHandler(...); }
When running the program, I terminate the proxy to break the connection, and then run kubectl proxy
command again. Instead of invoking retryOnException
we passed to exceptionHandler(....)
, it's endlessly attempting to reconnect, throwing lots of red logs (see below).
Of course, if you kubectl poxy
again, it will reconnect and continue monitoring the pod state but if the server is down for long, then I would like it to fail sooner or later (retryAfterException
would control it)
Fabric8 Kubernetes Client version
7.3.1
Steps to reproduce
- Run
kubectl proxy
- Initialize and start a new SharedIndexInformer
- Wait until it connects and receives first pod events
- Terminate the proxy (Ctrl + C in the terminal)
- Observe the logs - it's endlessly attempting to reconnect
Expected behavior
ExceptionHandler.retryAfterException
is invoked
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
other (please specify in additional context)
Environment
Windows, Azure
Fabric8 Kubernetes Client Logs
[vert.x-eventloop-thread-1] ERROR io.vertx.core.net.impl.ConnectionBase - Connection reset
[vert.x-eventloop-thread-3] INFO io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager - Unknown Watch error received 152 times without progress, will reconnect if possible
java.util.concurrent.CompletionException:
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: /127.0.0.1:8001 at java.base/java.util.concurrent.CompletableFuture.encode Throwable (CompletableFuture.java:332)
at java.base/java.util.concurrent.CompletableFuture.complete Throwable (CompletableFuture.java:347)
at java.base/java.util.concurrent.Completable Future$UniCompose.tryFire (CompletableFuture.java:1141)
at java.base/java.util.concurrent.CompletableFuture.postComplete (CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally (CompletableFuture.java:2162)
at io.fabric8.kubernetes.client.vertx. VertxHttpClient.lambda$buildWebSocketDirect$3 (VertxHttpClient.java:103)
at io.vertx.core.impl.future. Future Impl$2.onFailure (FutureImpl.java:117)
at io.vertx.core.impl.future. Future Impl$ListenerArray.onFailure (FutureImpl.java:316)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: /127.0.0.1:8001 Caused by: java.net.ConnectException: Connection refused: no further information
at java.base/sun.nio.ch.Net.pollConnect (Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow (Net.java:672)
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect (SocketChannelImpl.java:946)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect (NioSocketChannel.java:336)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect (AbstractNioChannel.java:339)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:784)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:732)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:658)
Additional context
SharedIndexInformer is tested on Windows 11. K8S cluster is on Azure Kubernetes Service. Azure Kubernetes Service is on version 1.31.8