While executing one of our automation tests, it sometimes hangs out. The
invoked code is camelContext.stopRoute(routeID);

Here is the stacktrace:

HTTP Handler 127.0.0.1" prio=6 tid=0x000000001035f000 nid=0x10d0 in
Object.wait() [0x000000001423b000]
   java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:503)
at
org.springframework.jms.listener.DefaultMessageListenerContainer.doShutdown(DefaultMessageListenerContainer.java:538)
- locked <0x00000000c5f308a8> (a java.lang.Object)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.shutdown(AbstractJmsListeningContainer.java:233)
at
org.springframework.jms.listener.AbstractJmsListeningContainer.destroy(AbstractJmsListeningContainer.java:173)
at
org.apache.camel.component.jms.JmsConsumer.stopAndDestroyListenerContainer(JmsConsumer.java:177)
at org.apache.camel.component.jms.JmsConsumer.doStop(JmsConsumer.java:212)
at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:92)
at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:114)
at
org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:306)
at
org.apache.camel.impl.DefaultShutdownStrategy.shutdownRoutesNow(DefaultShutdownStrategy.java:280)
at
org.apache.camel.impl.DefaultShutdownStrategy.doShutdown(DefaultShutdownStrategy.java:193)
at
org.apache.camel.impl.DefaultShutdownStrategy.shutdown(DefaultShutdownStrategy.java:130)
at
org.apache.camel.impl.DefaultShutdownStrategy.shutdown(DefaultShutdownStrategy.java:117)
at
org.apache.camel.impl.DefaultCamelContext.stopRoute(DefaultCamelContext.java:813)
- locked <0x00000000c57b2780> (a org.apache.camel.impl.DefaultCamelContext)

I have searched for this problem and it seems that it was introduced in
spring 2.5.6 and resolved in 3.0.5 but we are using 3.2.3. As i read a
possible solution is using suspend instead of stopping the route.

>From DefaultMessageListenerContainer class:

527 @Override
528 protected void More ...doShutdown() throws JMSException {
529 logger.debug("Waiting for shutdown of message listener invokers");
530 try {
531 synchronized (this.lifecycleMonitor) {
532 // Waiting for AsyncMessageListenerInvokers to deactivate themselves...
533 while (this.activeInvokerCount > 0) {
534 if (logger.isDebugEnabled()) {
535 logger.debug("Still waiting for shutdown of " + this.activeInvokerCount
+
536 " message listener invokers");
537 }
538 this.lifecycleMonitor.wait();
539 }
540 // Clear remaining scheduled invokers, possibly left over as paused
tasks...
541 for (AsyncMessageListenerInvoker scheduledInvoker :
this.scheduledInvokers) {
542 scheduledInvoker.clearResources();
543 }
544 this.scheduledInvokers.clear();
545 }
546 }
547 catch (InterruptedException ex) {
548 // Re-interrupt current thread, to allow other threads to react.
549 Thread.currentThread().interrupt();
550 }
551 }

It seems that there are some active invokers that prevent Spring listener to
properly shutdown. Maybe events are still flowing through Camel?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Stopping-route-is-hanging-infinitly-tp5739829.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to