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

Occur NullPointerException when using SharedInformers.stopAllRegisteredInformers() and the KubernetesClient.close() #3304

Closed
coderzc opened this issue Jul 7, 2021 · 3 comments · Fixed by #3306
Assignees
Labels
Milestone

Comments

@coderzc
Copy link

coderzc commented Jul 7, 2021

Occur NullPointerException when using SharedInformers.stopAllRegisteredInformers() and the KubernetesClient.close()

if (this.informerFactory != null) {
   this.informerFactory.stopAllRegisteredInformers();
}

if (this.kubeClient != null) {
    this.kubeClient.close();
}

The exception information:

java.lang.NullPointerException: null
	at java.util.ArrayList.<init>(ArrayList.java:178) ~[?:1.8.0_281]
	at io.fabric8.kubernetes.client.informers.cache.SharedProcessor.distribute(SharedProcessor.java:83) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.informers.cache.ProcessorStore.update(ProcessorStore.java:44) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.informers.cache.Reflector$ReflectorWatcher.eventReceived(Reflector.java:146) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.informers.cache.Reflector$ReflectorWatcher.eventReceived(Reflector.java:121) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.utils.WatcherToggle.eventReceived(WatcherToggle.java:49) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager.eventReceived(AbstractWatchManager.java:176) ~[kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager.onMessage(AbstractWatchManager.java:232) [kubernetes-client-5.5.0.jar:?]
	at io.fabric8.kubernetes.client.dsl.internal.WatcherWebSocketListener.onMessage(WatcherWebSocketListener.java:93) [kubernetes-client-5.5.0.jar:?]
	at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323) [okhttp-3.12.12.jar:?]
	at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219) [okhttp-3.12.12.jar:?]
	at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105) [okhttp-3.12.12.jar:?]
	at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274) [okhttp-3.12.12.jar:?]
	at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214) [okhttp-3.12.12.jar:?]
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203) [okhttp-3.12.12.jar:?]
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) [okhttp-3.12.12.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_281]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_281]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281]
@rohanKanojia
Copy link
Member

How can we reproduce this error? What kind of informers did you register into SharedInformerFactory which caused this NPE?

@coderzc
Copy link
Author

coderzc commented Jul 7, 2021

How can we reproduce this error? What kind of informers did you register into SharedInformerFactory which caused this NPE?

It is an occasional error, kind of register into SharedInformerFactory include Job、ConfigMap、CustomResource

@coderzc
Copy link
Author

coderzc commented Jul 7, 2021

@rohanKanojia I have a question the SharedInformerFactory.stopAllRegisteredInformers() whether is blocking until sharedInformer complete shutdown.

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jul 7, 2021
@shawkins shawkins self-assigned this Jul 7, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jul 7, 2021
@shawkins shawkins linked a pull request Jul 7, 2021 that will close this issue
11 tasks
@manusa manusa added this to the 5.6.0 milestone Jul 9, 2021
@manusa manusa added the bug label Jul 9, 2021
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