Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception: java.util.concurrent.RejectedExecutionException when closing LocalPortForward #6215

Closed
matteriben opened this issue Aug 2, 2024 · 1 comment · Fixed by #6217
Assignees
Milestone

Comments

@matteriben
Copy link
Contributor

matteriben commented Aug 2, 2024

Describe the bug

Closing an instance of LocalPortForward sometimes results in an unhandled RejectedExecutionException. This does not appear to be causing any problem other than producing unnecessary exception messages.

Fabric8 Kubernetes Client version

6.12.1

Steps to reproduce

Run nginx:

kubectl run nginx --image=nginx

Then run this test:

public class PortForwardTest {
    KubernetesClient client = new KubernetesClientBuilder().build();
    @Test
    void test() throws Exception {
        for (int i = 0; i < 1000; i++) {
            try (LocalPortForward lpf = client.pods().inNamespace("default").withName("nginx").portForward(80)) {
                new URL("http://localhost:" + lpf.getLocalPort()).openStream().close();
            }
        }
    }
}

Expected behavior

No unhandled exceptions.

Runtime

other (please specify in additional context)

Kubernetes API Server version

other (please specify in additional context)

Environment

Linux

Fabric8 Kubernetes Client Logs

2024-08-02 01:29:44,480 ERROR [io.ver.cor.imp.ContextImpl] (vert.x-eventloop-thread-9) Unhandled exception: java.util.concurrent.RejectedExecutionException
	at io.fabric8.kubernetes.client.utils.internal.SerialExecutor.execute(SerialExecutor.java:47)
	at io.fabric8.kubernetes.client.dsl.internal.PortForwarderWebsocketListener.onMessage(PortForwarderWebsocketListener.java:128)
	at io.fabric8.kubernetes.client.vertx.VertxWebSocket.lambda$init$0(VertxWebSocket.java:48)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handleBinaryFrame(WebSocketImplBase.java:658)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:603)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:589)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:279)
	at io.vertx.core.http.impl.WebSocketImplBase.receiveFrame(WebSocketImplBase.java:534)
	at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:255)
	at io.vertx.core.streams.impl.InboundBuffer.drain(InboundBuffer.java:242)
	at io.vertx.core.streams.impl.InboundBuffer.lambda$fetch$0(InboundBuffer.java:295)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:279)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:261)
	at io.vertx.core.impl.ContextInternal.lambda$runOnContext$0(ContextInternal.java:59)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Additional context

serverVersion:
  buildDate: "2024-02-14T22:25:42Z"
  compiler: gc
  gitCommit: 4b8e819355d791d96b7e9d9efe4cbafae2311c88
  gitTreeState: clean
  gitVersion: v1.29.2
  goVersion: go1.21.7
  major: "1"
  minor: "29"
  platform: linux/arm64
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Aug 2, 2024
@shawkins shawkins self-assigned this Aug 2, 2024
@matteriben
Copy link
Contributor Author

Thank you @shawkins !

@manusa manusa added this to the 7.0.0 milestone Aug 5, 2024 — with automated-tasks
@manusa manusa closed this as completed in 6c24a98 Aug 5, 2024
manusa pushed a commit that referenced this issue Aug 9, 2024
closes: #6215

Signed-off-by: Steve Hawkins <[email protected]>
(cherry picked from commit 6c24a98)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants