From d26488402a82c5188bb711c4d90d6e77f4ed6a91 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 25 Jun 2024 14:47:26 +0200 Subject: [PATCH] fix: swallow rejected execution after shutdown closes: #6059 (cherry picked from commit 1ac6b9a4023a3179d4fa8bf003d6030cbb5938ad) Signed-off-by: Marc Nuri --- CHANGELOG.md | 5 +++++ .../client/informers/impl/cache/ProcessorStore.java | 2 +- .../client/informers/impl/cache/SharedProcessor.java | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e83201ca7..ed95e0cdc9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## CHANGELOG +### 6.13.1 (2024-07-02) + +#### Bugs +* Fix #6059: Swallow rejected execution from internal usage of the informer executor + ### 6.13.0 (2024-05-29) #### Bugs diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorStore.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorStore.java index 647f71e409d..d21fed01e2a 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorStore.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorStore.java @@ -113,7 +113,7 @@ public void retainAll(Set nextKeys, Consumer cacheStateComplet } }); if (cacheStateComplete != null) { - cacheStateComplete.accept(this.processor::execute); + cacheStateComplete.accept(this.processor::executeIfPossible); } } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessor.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessor.java index 2de8832c118..55d5ecb0be2 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessor.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessor.java @@ -175,7 +175,11 @@ public ProcessorListener addProcessorListener(ResourceEventHandler } } - public void execute(Runnable runnable) { - this.executor.execute(runnable); + public void executeIfPossible(Runnable runnable) { + try { + this.executor.execute(runnable); + } catch (RejectedExecutionException e) { + // already shutdown + } } }