You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Akram <ak...@gmail.com> on 2015/06/10 11:33:42 UTC

Camel quartz memory leak

I am using camel quartz to run a job every minute. But whenever i restart the
quartz route I get the message:

appears to have started a thread named [MyScheduler_Worker-1] but has failed
to stop it.This is very likely to create a memory leak. Stack trace of
thread: java.lang.Object.wait(Native Method)
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543)
Jun 10, 2015 10:01:03 AM org.apache.catalina.loader.WebappClassLoaderBase
clearReferencesThreads



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel quartz memory leak

Posted by Greg Autric <ga...@redhat.com>.
Hi Akram,

feel free to rise a JIRA ticket (https://issues.apache.org/jira/browse/CAMEL)
And create an PR to github (https://github.com/apache/camel)

Camel commiters will analyse it, and accept it if it is confirmed issue.

thx for your help,

Greg AUTRIC                        
JBoss Middleware Consultant

email   : gautric __at__ redhat __dot__ com
twitter : @gautric_io

Red Hat Global Services            
Red Hat France SARL                sit: http://www.redhat.fr
Le Linea, 1 rue du General Leclerc, 92047 Paris La Défense Cedex
Sent from webmail

----- Mail original -----
De: "Akram" <ak...@gmail.com>
À: users@camel.apache.org
Envoyé: Mercredi 12 Août 2015 23:11:41
Objet: Re: Camel quartz memory leak

I have resolved the issue.. It is an issue with quartz component. Quartz was
being shutdown but the webapp didn't wait for quartz to finish before it
shutdown so Tomcat decided that it had left threads running and complained.
So, i override the shutdown method in quartzcomponent as follows and it
worked for me..

@Override
    public void shutdown() throws SchedulerException, InterruptedException {
        Scheduler scheduler = super.getScheduler();
        if (scheduler != null) {
            scheduler.shutdown(true);
            Thread.sleep(1000);
            scheduler = null;
        }
    }

Note the boolean argument to shutdown is the vital part. If you remove that
true to call the no-arg version or set it to false, your webapp won't wait
for quartz to shudown before it shuts down.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063p5770634.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel quartz memory leak

Posted by Akram <ak...@gmail.com>.
I have resolved the issue.. It is an issue with quartz component. Quartz was
being shutdown but the webapp didn't wait for quartz to finish before it
shutdown so Tomcat decided that it had left threads running and complained.
So, i override the shutdown method in quartzcomponent as follows and it
worked for me..

@Override
    public void shutdown() throws SchedulerException, InterruptedException {
        Scheduler scheduler = super.getScheduler();
        if (scheduler != null) {
            scheduler.shutdown(true);
            Thread.sleep(1000);
            scheduler = null;
        }
    }

Note the boolean argument to shutdown is the vital part. If you remove that
true to call the no-arg version or set it to false, your webapp won't wait
for quartz to shudown before it shuts down.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063p5770634.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel quartz memory leak

Posted by Willem Jiang <wi...@gmail.com>.
When you stop the route, the schedule won’t be shutdown.
But if you stop the camel context, the schedule will be shutdown if there is no CamelJob there.

Are there more than one camel-quartz endpoints in your camel route?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 15, 2015 at 10:36:57 PM, Akram (akram.sa18@gmail.com) wrote:
> I am using camel 2.15.1. Stopping the route using JMX, againg restarting it
> using JMX. Also the same getting same error if I restart entire camel
> context.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063p5768275.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Camel quartz memory leak

Posted by Akram <ak...@gmail.com>.
I am using camel 2.15.1. Stopping the route using JMX, againg restarting it
using JMX. Also the same getting same error if I restart entire camel
context.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063p5768275.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel quartz memory leak

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel do you use? And how do you restart the route?

On Wed, Jun 10, 2015 at 11:33 AM, Akram <ak...@gmail.com> wrote:
> I am using camel quartz to run a job every minute. But whenever i restart the
> quartz route I get the message:
>
> appears to have started a thread named [MyScheduler_Worker-1] but has failed
> to stop it.This is very likely to create a memory leak. Stack trace of
> thread: java.lang.Object.wait(Native Method)
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543)
> Jun 10, 2015 10:01:03 AM org.apache.catalina.loader.WebappClassLoaderBase
> clearReferencesThreads
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-quartz-memory-leak-tp5768063.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/