1
votes

I am trying to use async scope from within vm inbound endpoint whose exchange pattern is request -response. The idea is call two other flows asynchronously from the vmmainflow.From what I understand from the mule documentation, when a vm is used with request-response exchange pattern, the exceution is carried on same thread that invokes the vm. I now have a requirement to call two other flows from within this vm flow and they are one-way and can be invoked asynchronously. However, when I do the following from my mule-config, I get the error as shown below.This happens only with concurrent requests to the service. I am not sure about the approach of calling async from a vm. If this approach is wrong, please suggest how I go about this. I am thinking to use another flow with inbound as vm(one-way) which has actual calls to two flows and then call that new vm from my vmmainflow.

<flow name="vmmainflow">
    <vm:inbound-endpoint address="vm://vmmainflow"
            exchange-pattern="request-response" /> 
   ........   
    <async>
      <flow-ref name="flow1" /> 
      <flow-ref name="flow2" /> 
   </async> 
   .....
  </flow>

Following is the error I get:

      Exception in thread "null.processor.async.2" org.mule.api.MuleRuntimeException: An exception occurred while invoking message processor "DefaultMessageProcessorChain '(inner iterating chain) of 'async' child chain' 
[ 
  org.mule.api.processor.LoggerMessageProcessor@ccf1a3, 
  org.mule.api.processor.LoggerMessageProcessor@1fd937a, 
  org.mule.config.spring.factories.FlowRefFactoryBean$1@16a10c1
]" for asynchronously.
org.mule.processor.AsyncInterceptingMessageProcessor handleWorkException] - Work caused exception on 'workCompleted'. Work being executed was: org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker@483ebe
    at org.mule.processor.AsyncInterceptingMessageProcessor.handleWorkException(AsyncInterceptingMessageProcessor.java:197)
    at org.mule.processor.AsyncInterceptingMessageProcessor.workCompleted(AsyncInterceptingMessageProcessor.java:173)
    at org.mule.work.WorkerContext.run(WorkerContext.java:368)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.ConcurrentModificationException
    at org.apache.commons.collections.map.AbstractHashedMap$HashIterator.nextEntry(AbstractHashedMap.java:1113)
    at org.apache.commons.collections.map.AbstractHashedMap$KeySetIterator.next(AbstractHashedMap.java:938)
    at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1010)
    at org.mule.DefaultMuleMessage.copyMessageProperties(DefaultMuleMessage.java:228)
    at org.mule.DefaultMuleMessage.<init>(DefaultMuleMessage.java:203)
    at org.mule.DefaultMuleMessage.<init>(DefaultMuleMessage.java:279)
    at org.mule.DefaultMuleMessage.newThreadCopy(DefaultMuleMessage.java:1375)
    at org.mule.DefaultMuleEvent.newThreadCopy(DefaultMuleEvent.java:713)
    at org.mule.RequestContext.newEvent(RequestContext.java:135)
    at org.mule.RequestContext.setEvent(RequestContext.java:72)
    at org.mule.construct.SimpleFlowConstruct.process(SimpleFlowConstruct.java:125)
    at org.mule.config.spring.factories.FlowRefFactoryBean$1.process(FlowRefFactoryBean.java:40)
    at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:72)
    at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:89)
    at org.mule.processor.AbstractInterceptingMessageProcessor.processNext(AbstractInterceptingMessageProcessor.java:81)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
    at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:212)
    at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:41)
    at org.mule.work.WorkerContext.run(WorkerContext.java:309)
1
Could you please explain what was your question here ??.. You need to provide your Mule config so that all your issue could be detected ..Anirban Sen Chowdhary
Pls update your question with your full Mule flow .. Pls don't write your Mule flow in the comment section .. It's very difficult to read .. Please update the question with your flow thereAnirban Sen Chowdhary
Please look at the updated questionrst
@anirban-do you need any other information?rst
hmmm .. Could you pls provide the flow1 and flow2 .. then it would be clear what these flows expect ... In the meantime could you pls place a logger just before Async and print the message payload like the following :- <logger message="payload :-#[message.payload]" level="INFO" doc:name="Payload Logger" /> ... and let me know the value you getAnirban Sen Chowdhary

1 Answers

1
votes

This seems like a real bug to me. I can't think of something you could do wrong that would cause the async message scope to throw a ConcurrentModificationException while copying message properties.

Perhaps your next step should be to create an issue in the MuleSoft JIRA. If you are a MuleSoft enterprise customer, I encourage you to create a case in your support portal as well.. that can help move your issue to the front of the line. I suggest linking to this StackOverflow question in both.