Question

I've a Camel process (that I run from command line) which route is similar to this one:

public class ProfilerRoute extends RouteBuilder {

 @Override
 public void configure() {   
    from("kestrel://my_queue?concurrentConsumers=10&waitTimeMs=500")
        .unmarshal().json(JsonLibrary.Jackson, MyClass.class)
        .process(new Processor() {
                 @Override
                 public void process(Exchange exchange) throws Exception {
                     /* Do the real processing [...] */
                     exchange.getIn().setBody(null);
                 }
        })
        .filter(body().isNotNull())
        .to("file://nowhere");
 }
}

Note that I'm trashing whatever message after having processed it, being this a pure consumer process.

The process is run by its own. No other process is writing on the queue, the queue is empty. However when I try to kill the process the process is not going to die.

From the logs I see the following lines (indented for readability):

[                      Thread-1] MainSupport$HangupInterceptor  INFO  
                                 Received hang up - stopping the main instance.
[                      Thread-1] MainSupport                    INFO
                                 Apache Camel stopping
[                      Thread-1] GuiceCamelContext              INFO
                                 Apache Camel 2.11.1 (CamelContext: camel-1) 
                                 is shutting down
[                      Thread-1] DefaultShutdownStrategy        INFO
                                 Starting to graceful shutdown 1 routes 
                                 (timeout 300 seconds)
[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy        INFO
                                 Waiting as there are still 10 inflight and 
                                 pending exchanges to complete, 
                                 timeout in 300 seconds.

And so on with decreasing timeout. At the end of the timeout I get on the logs:

[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy        INFO
                                 Waiting as there are still 10 inflight and 
                                 pending exchanges to complete,
                                 timeout in 1 seconds.
[                      Thread-1] DefaultShutdownStrategy        WARN
                                 Timeout occurred. 
                                 Now forcing the routes to be shutdown now.
[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy        WARN
                                 Interrupted while waiting during graceful 
                                 shutdown, will force shutdown now.
[                      Thread-1] KestrelConsumer                INFO  
                                 Stopping consumer for 
                                 kestrel://localhost:22133/my_queue?concurrentConsumers=10&waitTimeMs=500

But the process will not die anyway (even if I try to kill it at this point).

I would have expected that after the waiting time all the threads would realise that a shutdown is going on and stop.

I've read the "Graceful Shutdown" document, however I could not find something that explains the behaviour I'm facing.

As you can see from logs I'm using the 2.11.1 version of Apache Camel.

UPDATE: According to Claus Ibsen it might be a problem of the camel-kestrel component. I filed a issue on ASF Jira for Camel: CAMEL-6632

Was it helpful?

Solution

This is a bug in camel-kestrel, and a JIRA ticket has been logged to fix this: https://issues.apache.org/jira/browse/CAMEL-6632

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top