Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SMXCOMP-567

ConcurrentModificationException when running servicemix-camel routes under high load

    XMLWordPrintableJSON

Details

    Description

      When running some kinds of Routes (e.g. using Camel threads(), seda queues, aggregator, ...), the JbiExchange/JbiMessage can outlive the time that the Camel endpoint needs for handling the underlying MessageExchange/NormalizedMessage. Under high load this can result in ConcurrentModificationExceptions like

      java.util.ConcurrentModificationException
      	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
      	at java.util.HashMap$KeyIterator.next(HashMap.java:828)
      	at java.util.Collections$UnmodifiableCollection$1next(Collections.java:1010)
      	at org.apache.servicemix.camel.JbiMessage.populateInitialHeaders(JbiMessatge.java:136)
      	at org.apache.camel.impl.DefaultMessage.createHeaders(DefaultMessage.java:92)
      	at org.apache.camel.impl.DefaultMessage.getHeaders(DefaultMessatge.java:69)
      	at org.apache.camel.impl.MessageSupport.copyFrom(MessageSupport.java:99)
      	at org.apache.camel.processor.Pipeline.createNextExchange(Pipeline.java:185)
      	at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:140)
      	at org.apache.camel.processor.DeadLetterChannel$1.done(DeadLetterChannel.java:191)
      	at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:74)
      	at org.apache.servicemix.camel.CamelConsumerEndpoint.process(CamelConsumerEndpoint.java:74)
      	at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
      	at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:571)
      	at org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
      	at org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
      	at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
      	at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
      	at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
      	at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:619)
      

      or

      java.util.ConcurrentModificationException
      	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
      	at java.util.HashMap$EntryIterator.next(HashMap.java:834)
      	at java.util.HashMap$EntryIterator.next(HashMap.java:832)
      	at java.util.AbstractMap.toString(AbstractMap.java:485)
      	at java.lang.String.valueOf(String.java:2827)
      	at java.lang.Stringbuilder.append(StringBuilder.java:115)
      	at org.apache.servicem.jbi.messaging.NormalizedMessageImpl.toString(NormalizedMessageImpl.java:225)
      	at java.lang.String.valueOf(String.java:2827)
      	at java.lang.StringBuilder.append(StringBuilder.java:115)
      	at org.apache.servicemix.camel.JbiMessage.toString(JbiMessage.java:48)
      	at java.lang.String.valueOf(String.java:2827)
      	at java.lang.StringBuilder.append(StringBuider.java:115)
      	at org.apache.camel.NoTypeConversionAvailableException.<init>(NoTypeConversionAvailableException.java:29)
      	at org.apache.camel.impl.converter.DefaultTypeConverter.converTo(DefaultTypeConverter.java:117)
      	at org.apache.camel.impl.converter.DefaultTypeConverter.converTo(DefaultTypeconverter.java:65)
      	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:69)
      	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:51)
      	at org.apache.camel.component.log.LogFormatter.getBodyAsString(LogFormatter.java:182)
      	at org.apache.camel.component.log.LogFormatter.format(LogFormatter.java:74)
      	at org.apache.camel.processor.Logger.logMessage(Logger.java:234)
      	at org.apache.camel.processor.Logger.process(Logger.java:73)
      	at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
      	at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)
      	at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84)
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
      	at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:178)
      	at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:132)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
      	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)
      	at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:69)
      	at java.lang.Thread.run(Thread.java:619)
      

      Attachments

        Activity

          People

            gertvanthienen Gert Vanthienen
            gertvanthienen Gert Vanthienen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: