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

Upload InputStream To Pod with java.io.InterruptedIOException: interrupted (6.0.0-RC1) #4249

Closed
neuropaddy opened this issue Jul 5, 2022 · 4 comments · Fixed by #4730
Closed
Assignees
Labels
Milestone

Comments

@neuropaddy
Copy link

Describe the bug

An unexpected ERROR InterruptedIOException occurred while using 'upload' API in kubernetesClient 6.0.0-RC1, but, this exception does not occur in v5.12.2.

Fabric8 Kubernetes Client version

6.0.0-RC1

Steps to reproduce

  1. In 6.0.0-RC1, run the following code
    try (KubernetesClient client = new KubernetesClientBuilder().build()) {
    client.pods().inNamespace(nameSpace) // <- Namespace of Pod
    .withName(podName) // <- Name of Pod
    .file(podFileLocation) // <- Target location of copied file inside Pod
    .upload(new ByteArrayInputStream(content.getBytes()));
    }
  2. Then, a ERROR InterruptedIOException triggered.
  3. Rollback to v5.12.2, run the following code, the above ERROR exception is not happened
    try (KubernetesClient client = new DefaultKubernetesClient()) {
    client.pods().inNamespace(nameSpace) // <- Namespace of Pod
    .withName(podName) // <- Name of Pod
    .file(podFileLocation) // <- Target location of copied file inside Pod
    .upload(new ByteArrayInputStream(content.getBytes()));
    }

Expected behavior

Suppose the ERROR InterruptedIOException does not occurred in v.6.0.0-RC1.

Runtime

minikube

Kubernetes API Server version

other (please specify in additional context)

Environment

Linux

Fabric8 Kubernetes Client Logs

{"log":"20220705 03:40:53.323 ERROR - [OkHttp https://10.96.0.1/...]  i.f.k.c.d.i.ExecWebSocketListener        : Exec Failure\n","stream":"stdout","time":"2022-07-05T03:40:53.324556993Z"}
{"log":"\n","stream":"stdout","time":"2022-07-05T03:40:53.324585428Z"}
{"log":"java.io.InterruptedIOException: interrupted\n","stream":"stdout","time":"2022-07-05T03:40:53.324587792Z"}
{"log":"\u0009at okio.Timeout.throwIfReached(Timeout.kt:98)\n","stream":"stdout","time":"2022-07-05T03:40:53.324589736Z"}
{"log":"\u0009at okio.InputStreamSource.read(JvmOkio.kt:87)\n","stream":"stdout","time":"2022-07-05T03:40:53.324605265Z"}
{"log":"\u0009at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)\n","stream":"stdout","time":"2022-07-05T03:40:53.324607129Z"}
{"log":"\u0009at okio.RealBufferedSource.request(RealBufferedSource.kt:206)\n","stream":"stdout","time":"2022-07-05T03:40:53.324608842Z"}
{"log":"\u0009at okio.RealBufferedSource.require(RealBufferedSource.kt:199)\n","stream":"stdout","time":"2022-07-05T03:40:53.324610535Z"}
{"log":"\u0009at okio.RealBufferedSource.readByte(RealBufferedSource.kt:209)\n","stream":"stdout","time":"2022-07-05T03:40:53.324612199Z"}
{"log":"\u0009at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119)\n","stream":"stdout","time":"2022-07-05T03:40:53.324613892Z"}
{"log":"\u0009at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102)\n","stream":"stdout","time":"2022-07-05T03:40:53.324615625Z"}
{"log":"\u0009at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)\n","stream":"stdout","time":"2022-07-05T03:40:53.324617328Z"}
{"log":"\u0009at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)\n","stream":"stdout","time":"2022-07-05T03:40:53.324619002Z"}
{"log":"\u0009at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)\n","stream":"stdout","time":"2022-07-05T03:40:53.324620705Z"}
{"log":"\u0009at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n","stream":"stdout","time":"2022-07-05T03:40:53.324622358Z"}
{"log":"\u0009at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n","stream":"stdout","time":"2022-07-05T03:40:53.324624061Z"}
{"log":"\u0009at java.base/java.lang.Thread.run(Thread.java:833)\n","stream":"stdout","time":"2022-07-05T03:40:53.324625805Z"}

Additional context

API server version: k8s.gcr.io/kube-apiserver:v1.23.3

@manusa manusa added the bug label Jul 5, 2022
@manusa manusa added this to the 6.0.0 milestone Jul 5, 2022
@shawkins
Copy link
Contributor

shawkins commented Jul 5, 2022

@neuropaddy I haven't reproduced this yet. From what I can see, this exception is just being logged - it's not causing the upload to fail, is that correct?

This looks like a timing issue with websocket resources not being fully closed by the time the client is closing. However the ExecWatch should have already been closed at that point.

@neuropaddy
Copy link
Author

neuropaddy commented Jul 6, 2022

Yes, the upload operation is success and the content can be written to the pod.
As I observed the log is appeared before the socket close, I wonder if there is a async effect.

@manusa manusa modified the milestones: 6.0.0, 6.x Jul 8, 2022
@sunix sunix self-assigned this Sep 21, 2022
@sunix
Copy link
Collaborator

sunix commented Sep 23, 2022

I could not reproduce this (jbang + minikube).
@shawkins do you have any hints?

@shawkins
Copy link
Contributor

@sunix we probably just need to filter this - check if the exitCode future is done, if it is then there's no need to call the listener method or log.

@sunix sunix removed their assignment Sep 26, 2022
@manusa manusa modified the milestones: 6.x, 6.3.0 Oct 19, 2022
@manusa manusa modified the milestones: 6.3.0, 6.4.0 Dec 12, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 4, 2023
@shawkins shawkins self-assigned this Jan 4, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 4, 2023
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants