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

camel-qaurtz - Memory leak - when an exception is thrown during the scheduling phase

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.10.4, 2.11.0, 2.11.2
    • Fix Version/s: 2.11.3, 2.12.2, 2.13.0
    • Component/s: camel-quartz
    • Labels:
    • Environment:

      OS - Windows 7 and Unix. Server – OSGi equinox

    • Estimated Complexity:
      Unknown

      Description

      Hello,

      I have observed a memory leak for Quartz worker thread in case an exception is thrown during
      the scheduling phase when schedule is set to past time.
      I have observed this issue with camel-quart 2.10.4, 2.11.0, 2.11.2 versions.

      For ex, assuming today is 4-Oct; If a schedule is provided for yesterday (i.e 3-Oct) then
      below sequence happen:

      1. Quartz create worker thread for new schedule [generally TEN Threads with name 'DefaultQuartzScheduler']
      2. Camel-quartz increment jobCounter for scheduler context [using QuartzComponent.incrementJobCounter()]
      3. Camel-quartz tries to create new schedule [using Scheduler.scheduleJob()]
      4. scheduleJob() throws SchedulerException with the message - 'Based on configured schedule,
      the given trigger will never fire'
      5. Camel-quartz does NOT decrement the job counter and jobCounter value remains '1'
      6. Later Camel-Quartz stops the route and call QuartzComponent.doStop()
      7. In doStop(), Scheduler.shutdown() supposed to be called so that those TEN threads are
      removed but to call shutdown() the pre-condition is that the jobCounter should be '0'. In
      this case jobCounter is '1' and Scheduler.shutdown() will NOT be called and those TEN threads
      are NOT removed. This is memory leak.

      Please find the stack trace in attachment 'memory_leak_scheduler_stack_trace.log' [with Camel-Quartz 2.11.2 and org.apache.servicemix.bundles.quartz-1.8.6_1
      which wrapped Quartz Scheduler as OSGi bundle] when SchedulerException is thrown at step
      4 in above sequence.

      Thanks,
      Nurali

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              nurali.techie@yahoo.com Nurali
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: