同时使用多个线程调用下面的路由,当消息超时时,我遇到了死锁。这个问题有解决方法吗?或者我错误配置了故障转移?
我创建了一个简单的项目来演示这个问题: https://github.com/leechinkong/CamelFailoverLoadbalancer
from("direct:test")
.loadBalance()
.failover(3, true, true)
.inOut("jms:testRqQueue1?replyTo=testRsQueue1&useMessageIDAsCorrelationID=true","jms:testRqQueue2?replyTo=testRsQueue2&useMessageIDAsCorrelationID=true");
线程转储:
"Camel (camel-1) thread #0 - JmsReplyManagerTimeoutChecker[testRsQueue1]":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007aca28f60> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
at org.apache.camel.support.DefaultTimeoutMap.putIfAbsent(DefaultTimeoutMap.java:116)
at org.apache.camel.component.jms.reply.CorrelationTimeoutMap.putIfAbsent(CorrelationTimeoutMap.java:108)
at org.apache.camel.component.jms.reply.ReplyManagerSupport.registerReply(ReplyManagerSupport.java:105)
at org.apache.camel.component.jms.JmsProducer$1.createMessage(JmsProducer.java:227)
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:282)
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:225)
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:239)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:493)
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:236)
at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:409)
at org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.java:239)
at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.builder.NoErrorHandlerBuilder$1.process(NoErrorHandlerBuilder.java:40)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.FatalFallbackErrorHandler.process(FatalFallbackErrorHandler.java:49)
at org.apache.camel.processor.RedeliveryErrorHandler.deliverToFailureProcessor(RedeliveryErrorHandler.java:896)
at org.apache.camel.processor.RedeliveryErrorHandler.processAsyncErrorHandler(RedeliveryErrorHandler.java:561)
at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:466)
at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:86)
at org.apache.camel.processor.SendProcessor$1.done(SendProcessor.java:139)
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:250)
at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:145)
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:250)
at org.apache.camel.builder.NoErrorHandlerBuilder$1$1.done(NoErrorHandlerBuilder.java:44)
at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:86)
at org.apache.camel.processor.SendProcessor$1.done(SendProcessor.java:139)
at org.apache.camel.component.jms.reply.ReplyManagerSupport.processReply(ReplyManagerSupport.java:179)
at org.apache.camel.component.jms.reply.TemporaryQueueReplyHandler.onTimeout(TemporaryQueueReplyHandler.java:61)
at org.apache.camel.component.jms.reply.CorrelationTimeoutMap.onEviction(CorrelationTimeoutMap.java:54)
at org.apache.camel.component.jms.reply.CorrelationTimeoutMap.onEviction(CorrelationTimeoutMap.java:30)
at org.apache.camel.support.DefaultTimeoutMap.purge(DefaultTimeoutMap.java:230)
at org.apache.camel.support.DefaultTimeoutMap.run(DefaultTimeoutMap.java:180)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Found 1 deadlock.
答案 0 :(得分:0)
与骆驼一起提出:https://issues.apache.org/jira/browse/CAMEL-9994
该问题已在2.17.2 / 2.18.0
中修复