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

throw NPE when copy file from pod to local #3384

Closed
ttbadr opened this issue Aug 6, 2021 · 3 comments · Fixed by #3478
Closed

throw NPE when copy file from pod to local #3384

ttbadr opened this issue Aug 6, 2021 · 3 comments · Fixed by #3478
Assignees
Milestone

Comments

@ttbadr
Copy link
Contributor

ttbadr commented Aug 6, 2021

I got an NPE when I try to copy a file from pod to local, here is my code:

getClient().pods()
        .withName(podName)
        .inContainer(containerName)
        .dir(pathInPod)
        .copy(Paths.get(localPath));

exception:

Aug 07, 2021 12:00:06 AM io.fabric8.kubernetes.client.utils.InputStreamPumper lambda$pump$0
SEVERE: Error while pumping stream.
java.lang.NullPointerException: Cannot invoke "java.io.InputStream.available()" because "this.val$is" is null
	at io.fabric8.kubernetes.client.utils.InputStreamPumper$1.read(InputStreamPumper.java:53)
	at io.fabric8.kubernetes.client.utils.InputStreamPumper.transferTo(InputStreamPumper.java:76)
	at io.fabric8.kubernetes.client.utils.InputStreamPumper.lambda$pump$0(InputStreamPumper.java:89)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:831)

fabric8 version is 5.6.0

Update:
I tried it again use the same params, I found that the file copied from the pod successfully, but I still got the same NPE

@rohanKanojia
Copy link
Member

Are valid values being passed to dir() and copy methods? Do you have some simple reproducer project which we can use?

@shawkins
Copy link
Contributor

shawkins commented Aug 6, 2021

If it's possible that there can be no in nor inputPipe, then this npe could occur - the old code wasn't doing an explicit null check before starting the pumper, so there's not one in the new code. This is simply logged, not actually thrown, correct? I'm guessing it was swallowed before.

@ttbadr
Copy link
Contributor Author

ttbadr commented Aug 7, 2021

Are valid values being passed to dir() and copy methods? Do you have some simple reproducer project which we can use?

the values are valid I confirmed.
I tried it again use the same params, I found that the file copied from the pod successfully, but I still got the same NPE

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.

4 participants