Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7666

CamelContext.addService may fail with java.util.ConcurrentModificationException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.12.4, 2.13.2
    • 2.12.5, 2.13.3, 2.14.0
    • camel-core
    • None
    • Unknown

    Description

      Most likely to happen only for pojo consuming where you may have a JMS listener execute concurrently and do some routing, and on initial messages then they need to register as service in CamelContext which can trigger to this ConcurrentModificationException.

      2014-08-07 10:09:09,338 [sonnel.records]] WARN  EndpointMessageListener        - Execution of JMS message listener failed. Caused by: [org.apache.camel.FailedToCreateProducerException - Failed to create Producer for endpoint: Endpoint[file://target/messages/amer/finance_pickup]. Reason: java.util.ConcurrentModificationException]
      org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[file://target/messages/amer/finance_pickup]. Reason: java.util.ConcurrentModificationException
      	at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:410)
      	at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123)
      	at org.apache.camel.processor.RecipientListProcessor.createProcessorExchangePairs(RecipientListProcessor.java:174)
      	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)
      	at org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:167)
      	at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:286)
      	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
      	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
      	at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
      	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
      	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)
      	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:744)
      Caused by: java.util.ConcurrentModificationException
      	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
      	at java.util.ArrayList$Itr.next(ArrayList.java:831)
      	at org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:976)
      	at org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:963)
      	at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:408)
      	... 22 more
      2014-08-07 10:09:09,345 [main           ] INFO  SpringCamelContext             - Apache Camel 2.14-SNAPSHOT (CamelContext: camel-1) started in 0.254 seconds
      2014-08-07 10:09:14,347 [main           ] INFO  CamelContextTest               - ********************************************************************************
      2014-08-07 10:09:14,347 [main           ] INFO  CamelContextTest               - Testing done: testCheckFiles(org.apache.camel.example.pojo_messaging.CamelContextTest)
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: