java: Copy.copyFileToPod() hangs waiting for process to complete
Client Version: 13.0.0 Kubernetes Version: 1.19.12-gke.2100 Java Version: Java 1.8.0_291 **Server
- OS: Ubuntu 20.04.1 LTS
- Environment: GKE Container
- Cloud : GCP/GKE
I have the copyFileFromPod() working, but copyFileToPod() hangs at Copy.java line 459 at proc.waitFor(). I’ve pulled source, but I don’t understand the websockets well enough to know what is going on. A copy command from the command-line works fine.
I’ve verified that the ‘tar’ and ‘base64’ executables exist in the container:
> root@test-gcp-dev-gke-guse4a-0:/tmp# which tar
> /usr/bin/tar
> root@test-gcp-dev-gke-guse4a-0:/tmp# which base64
> /usr/bin/base64
> root@test-gcp-dev-gke-guse4a-0:/tmp# cat /etc/issue
> Ubuntu 20.04.1 LTS \n \l
>
I’ve not changed the timeouts as I’d expect a simple text file copy would work within the defaults.
It never seems to timeout or throw an error so I don’t have any stack traces.
Also, I tried API version 12.0.1 (throws SocketTimeout almost immediately) and 11.0.2 (hangs just like 13.0.0).
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Fix for #1826: Updated WebSocketStreamHandler.write() to calculate 'remaining' bytes using bufferSize from the current loop iteration instead of the cummulative bytesWritten. Related to #1822: Remove... — committed to PredatorVI/java by PredatorVI 3 years ago
- Fix for #1826: Updated WebSocketStreamHandler.write() to calculate 'remaining' bytes using bufferSize from the current loop iteration instead of the cummulative bytesWritten. Related to #1822: Remove... — committed to PredatorVI/java by PredatorVI 3 years ago
- Fix for #1826: Updated WebSocketStreamHandler.write() to calculate 'remaining' bytes using bufferSize from the current loop iteration instead of the cummulative bytesWritten. Related to #1822: Remove... — committed to PredatorVI/java by PredatorVI 3 years ago
- - Fix for #1826: Updated WebSocketStreamHandler.write() to calculate 'remaining' bytes using bufferSize from the current loop iteration instead of the cummulative bytesWritten. - Related to #1822: Re... — committed to PredatorVI/java by PredatorVI 3 years ago
I can confirm that this issue still exists in the newest version 16.0.0 of
client-java. I am using the local installation of K8s 1.22.tarcommand works just fine locally:I think the issue is: https://github.com/kubernetes/kubernetes/issues/89899 Basically remote exec command does not detect the end of STDIN.
FWIW, I am having this same issue using copyFileToPod( String, String, String, Path, Path) using the Java API, version 13.0.1-SNAPSHOT.
As soon as the client code hits the copyFileToPod line, it hangs there apparently indefinitely. Only when I kill the client side process does the file get written in the container. The container in question is the only container in the pod and is running the fedora:latest image. The Kubernetes cluster in question is an Azure AKS cluster.
OTOH, copyFileToPodAsync() has no problem. I just took the Future it returned, wrapped it in a while(true) loop with a check on isDone() and everything worked as expected.