camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdo <>
Subject 2.11, File2, Quartz: threads leaking
Date Thu, 02 May 2013 16:20:22 GMT

I've constructed a thread leak somehow. I found some discussions/issues
describing past thread leaking problems, e.g.:

So obviously there has been some work to fix those issues. In one case Claus
advised the user that he must stop a producer template. I'm not sure how to
solve my problem. Find my setup description of a Quartz-triggered file
consumer route below.

A file consumer:

The null-Body is used as route-stop-trigger, I use a processor that starts
up a thread as described here:
... with these actions:
I also tried a stop() on the getFromEndpoint() here.

A Quartz route, periodically firing the file consumer route based on cron
    .process(new RouteStartProcessor(routeId));

process() in RouteStartProcessor:
CamelContext context = exchange.getContext();

I now added a loop to the RouteStartProcessor waiting for the file consumer
route to shutdown itself (to prevent overlaps), evaluated by:
routeStopped = context.getRouteStatus(routeId).isStopped();

This actually does work fine, so I assume that the route gets stopped
successfully. Logs: o.a.c.impl.DefaultShutdownStrategy - Graceful shutdown
of 1 routes completed in 0 seconds

Whenever Quartz fires and the consumer route gets re-started this brings up
a new thread id which I can see in the logs.

Albeit the route obviously is shut down, the threads stay alive, all in
state: java.lang.Thread.State: WAITING (parking)

I dug around a bit in the VM's MBeans, there are:
* 2 consumers, a FileConsumer and a QuartzConsumer
* a large amount of threadpools (equal to the number of waiting threads),
having IDs like FileConsumer(0x138dc688)

Attributes of an example instance:
Thread pool profile: --
Shutdown: false
Active count: 0
Pool size: 1
Task queue size: 0
Keep alive time: 0
Completed task count: 2 
Core pool size: 1
Largest pool size: 1
Task count: 2
Id: FileConsumer(0x138dc688)
Maximum pool size: 2147483647
Task count: 2

My environment:
GlassFish 3
CDI Camel context
Camel 2.11.0

Any hints? Thanks in advance!

Regards, mdo.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message