Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3614

Thread leak in WorkQueueManagerImpl and AutomaticWorkQueueImpl when we use it in tomcat

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.1
    • 2.3.6, 2.4.2, 2.5
    • Core
    • None

    Description

      Hi,

      There is the threadleak in WorkQueueManagerImpl / AutomaticWorkQueueImpl when we use it in tomcat or other web container. In AutomaticWorkQueueImpl created by WorkQueueManagerImpl, it has a class WatchDog which is a daemon thread, If we call shutdown in WorkQueueManagerImpl, it only clean the queue in AutomaticWorkQueueImpl but it won't notify WatchDog thread, so the WatchDog will wait and live until we exit JVM.
      It won't cause issue if we run CXF as standalone app, however, it will cause thread leak in tomcat because we do not stop tomcat when we undeploy cxf web-app, so we cannot destroy WatchDog thread in this case.

      Could you please fix it? thanks.

      public class MyWorkQueueManagerImpl extends WorkQueueManagerImpl implements DisposableBean {
      
          @Override
          public void destroy() throws Exception {
              this.shutdown(false);
              for (AutomaticWorkQueue queue : namedQueues.values()) {
                  if (queue instanceof AutomaticWorkQueueImpl) {
                      AutomaticWorkQueueImpl queueimpl = ((AutomaticWorkQueueImpl) queue);
                      queueimpl.terminated();
                      queueimpl.watchDog.interrupt();
                  }
              }
          }
      }
      

      David

      Attachments

        Activity

          People

            njiang Willem Jiang
            veaven David Liu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: