java
java copied to clipboard
java.net.SocketException: Connection or outbound has been closed
Describe the bug
When doing more complex kubectl exec calls using the example code based on https://github.com/kubernetes-client/java/blob/master/examples/examples-release-latest/src/main/java/io/kubernetes/client/examples/ExecExample.java I am very often observing an exception
java.net.SocketException: Connection or outbound has been closed
at sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:267)
at sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1193)
at okio.OutputStreamSink.write(JvmOkio.kt:56)
at okio.AsyncTimeout$sink$1.write(AsyncTimeout.kt:102)
at okio.RealBufferedSink.flush(RealBufferedSink.kt:268)
at okhttp3.internal.ws.WebSocketWriter.writeControlFrame(WebSocketWriter.kt:142)
at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.kt:102)
at okhttp3.internal.ws.RealWebSocket.writeOneFrame$okhttp(RealWebSocket.kt:533)
at okhttp3.internal.ws.RealWebSocket$WriterTask.runOnce(RealWebSocket.kt:620)
at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
It still works, it doesn't break the call, but it is very annoying and unnecessarily attracts attention when looking at the logs from the tool.
Client Version
20.0.0
Kubernetes Version
e.g. 1.26.5
Java Version Java 8
To Reproduce Steps to reproduce the behavior: Run the code from https://github.com/kubernetes-client/java/blob/master/examples/examples-release-latest/src/main/java/io/kubernetes/client/examples/ExecExample.java couple of times.
Expected behavior Exception should not be thrown.
Additional context This was already reported in https://github.com/kubernetes-client/java/issues/1891 , https://github.com/kubernetes-client/java/issues/1923 but wasn't fixed. Maybe this time?