Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11020

Camel Kubernetes consumers do not close watchers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.18.3, 2.19.0
    • Fix Version/s: 2.18.4, 2.19.0
    • Component/s: camel-kubernetes
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I've been experimenting with camel-kubernetes and noticed some odd behaviour after my camel context is shut down. It seems that not everything is cleaned up and there are still some background threads running.

      I wrote a unit test that can help to replicate the problem.

      Run the test, then wait for the camel context to shut down. Afterwards, the thread will sleep for 5 minutes. During this time, stop the Kubernetes cluster and you'll see the following exception thrown (or something like it):

      java.io.IOException: closed
      	at okhttp3.internal.ws.WebSocketWriter.writeControlFrameSynchronized(WebSocketWriter.java:119)
      	at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:111)
      	at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:168)
      	at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$1.onClose(WatchConnectionManager.java:256)
      	at okhttp3.internal.ws.RealWebSocket.peerClose(RealWebSocket.java:197)
      	at okhttp3.internal.ws.RealWebSocket.access$200(RealWebSocket.java:38)
      	at okhttp3.internal.ws.RealWebSocket$1$2.execute(RealWebSocket.java:84)
      	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      Which indicates that the pod watcher was still active and connected to the k8s cluster, despite camel having been shutdown. This is not ideal when Camel is run within an OSGI or JavaEE container.

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              jamesnetherton James Netherton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: