Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15482

Race Condition When Initializing Dynamic (toD) JMS Endpoints Under Load

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • fuse-7.9-GA
    • fuse-7.5-GA, fuse-7.7-GA
    • Camel, Spring Boot
    • None
    • False
    • False
    • % %
    • Undefined
    • Hide

      It's better to use to() for camel-jms and then a header for the dynamic queue name:

          .setHeader("CamelJmsDestinationName", exchangeProperty("queuename"))
          .to("jms:queue:dummy")
      
      Show
      It's better to use to() for camel-jms and then a header for the dynamic queue name: .setHeader( "CamelJmsDestinationName" , exchangeProperty( "queuename" )) .to( "jms:queue:dummy" )
    • Hide

      Reproducer attached. Scaling back the number of threads / endpoints seems to reduce or eliminate the error. To run, just spin up a local broker on 61616 and build and run the spring-boot project.

      Show
      Reproducer attached. Scaling back the number of threads / endpoints seems to reduce or eliminate the error. To run, just spin up a local broker on 61616 and build and run the spring-boot project.

      When initializing JMS components / dynamic endpoints under a load (for example when spinning up multiple routes with dynamic JMS producers at the same time) under Spring Boot 2 with @Bean annotated JMS configuration components, some endpoints fail with:

      09:55:12.291 [Camel (MyCamel) thread #34 - timer://foo-33] WARN  o.a.c.component.timer.TimerConsumer - Error processing exchange. Exchange[ID-dhawkins-remote-csb-1609599302970-0-3034]. Caused by: [java.lang.IllegalArgumentException - connectionFactory must be specified]
      java.lang.IllegalArgumentException: connectionFactory must be specified
      	at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:321)
      	at org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1656)
      	at org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(JmsConfiguration.java:782)
      	at org.apache.camel.component.jms.JmsConfiguration.createTemplateConnectionFactory(JmsConfiguration.java:1673)
      	at org.apache.camel.component.jms.JmsConfiguration.getTemplateConnectionFactory(JmsConfiguration.java:835)
      	at org.apache.camel.component.jms.JmsConfiguration.createInOnlyTemplate(JmsConfiguration.java:683)
      	at org.apache.camel.component.jms.JmsEndpoint.createInOnlyTemplate(JmsEndpoint.java:316)
      	at org.apache.camel.component.jms.JmsProducer.getInOnlyTemplate(JmsProducer.java:496)
      	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:416)
      	at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:394)
      	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:157)
      	at org.apache.camel.processor.SendDynamicProcessor$1.doInAsyncProducer(SendDynamicProcessor.java:178)
      	at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:439)
      	at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:160)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
      	at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
      	at java.util.TimerThread.mainLoop(Timer.java:555)
      	at java.util.TimerThread.run(Timer.java:505)
      

      The same code seems to run fine under older Camel versions with Spring Boot 1. I tried disabling lazy initialization explicitly with @Lazy(false) on the jms configuration beans and lazy-init="false" in the context, but still saw the error.

              ldemasi Luigi De Masi
              rhn-support-dhawkins Duane Hawkins
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: