java.lang.IllegalStateException: Only owner thread can write to message: Thread[connector.http.mule.default.receiver.02,5,]/Thread[connector.http.mule.default.receiver.04,5,main]

mulesoft.com | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Concurrent requests fails due to thread issue in Flow/Sub-flow - MuleSoft

    mulesoft.com | 7 months ago
    java.lang.IllegalStateException: Only owner thread can write to message: Thread[connector.http.mule.default.receiver.02,5,]/Thread[connector.http.mule.default.receiver.04,5,main]
  2. 0

    With the included test cases you can reproduce the issue for Services and Flows. At startup all is fine. New messages are sent using mule client. Once the seda queue is full and all threads are still busy you can face this issue. When the threadWaitTimeout expires the message is refused. On the exception handling that follows you get the below exception which crashes the service or flow. Under test/resources there are 2 thread dumps, one before and one after the crash. In the second dump you can see that the dispatcher thread "sedaFlowCrash.stage1.01" has effectively died. #### - ERROR 2011-12-21 17:32:34,366 [sedaFlowCrash.stage1.01] org.mule.exception.DefaultMessagingExceptionStrategy: Caught exception in Exception Strategy: ThreadPoolExecutor did not accept within 500 MILLISECONDS java.util.concurrent.RejectedExecutionException: ThreadPoolExecutor did not accept within 500 MILLISECONDS at org.mule.util.concurrent.WaitPolicy.rejectedExecution(WaitPolicy.java:62) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) at org.mule.work.ScheduleWorkExecutor.doExecute(ScheduleWorkExecutor.java:41) at org.mule.work.MuleWorkManager.executeWork(MuleWorkManager.java:250) at org.mule.work.MuleWorkManager.scheduleWork(MuleWorkManager.java:218) at org.mule.processor.SedaStageInterceptingMessageProcessor.run(SedaStageInterceptingMessageProcessor.java:233) at org.mule.work.WorkerContext.run(WorkerContext.java:310) 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:662) #### - WARN 2011-12-21 17:32:34,378 [sedaFlowCrash.stage1.01] org.mule.DefaultMuleMessage: Message access violation java.lang.IllegalStateException: Only owner thread can write to message: Thread[connector.VM.mule.default.receiver.03,5,main]/Thread[sedaFlowCrash.stage1.01,5,main] at org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1574) at org.mule.DefaultMuleMessage.checkMutable(DefaultMuleMessage.java:1560) at org.mule.DefaultMuleMessage.assertAccess(DefaultMuleMessage.java:1489) at org.mule.DefaultMuleMessage.setExceptionPayload(DefaultMuleMessage.java:993) at org.mule.exception.AbstractMessagingExceptionStrategy.handleException(AbstractMessagingExceptionStrategy.java:60) at org.mule.exception.AbstractMessagingExceptionStrategy.handleException(AbstractMessagingExceptionStrategy.java:66) at org.mule.processor.SedaStageInterceptingMessageProcessor.run(SedaStageInterceptingMessageProcessor.java:239) at org.mule.work.WorkerContext.run(WorkerContext.java:310) 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:662) #### - ERROR 2011-12-21 17:32:34,383 [sedaFlowCrash.stage1.01] org.mule.processor.AsyncWorkListener: Work caused exception on 'workCompleted'. Work being executed was: org.mule.processor.SedaStageInterceptingMessageProcessor Exception in thread "sedaFlowCrash.stage1.01" org.mule.api.MuleRuntimeException: An exception occurred while invoking message processor "DefaultMessageProcessorChain '(inner iterating chain) of 'sedaFlowCrash' processor chain' [ DefaultJavaComponent{sedaFlowCrash.commponent.1821889520}, DefaultOutboundEndpoint{endpointUri=vm://flow.out, connector=VMConnector { name=connector.VM.mule.default lifecycle=start this=63fb050c numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=true connected=true supportedProtocols=[vm] serviceOverrides=<none> } , name='endpoint.vm.flow.out', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}, org.mule.routing.requestreply.AsyncReplyToPropertyRequestReplyReplier ]" for asynchronously. at org.mule.processor.AsyncWorkListener.handleWorkException(AsyncWorkListener.java:74) at org.mule.processor.AsyncWorkListener.workCompleted(AsyncWorkListener.java:50) at org.mule.work.WorkerContext.run(WorkerContext.java:369) 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:662) Caused by: java.lang.IllegalStateException: Only owner thread can write to message: Thread[connector.VM.mule.default.receiver.03,5,main]/Thread[sedaFlowCrash.stage1.01,5,main] at org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1574) at org.mule.DefaultMuleMessage.checkMutable(DefaultMuleMessage.java:1560) at org.mule.DefaultMuleMessage.assertAccess(DefaultMuleMessage.java:1489) at org.mule.DefaultMuleMessage.setExceptionPayload(DefaultMuleMessage.java:993) at org.mule.exception.AbstractMessagingExceptionStrategy.handleException(AbstractMessagingExceptionStrategy.java:60) at org.mule.exception.AbstractMessagingExceptionStrategy.handleException(AbstractMessagingExceptionStrategy.java:66) at org.mule.processor.SedaStageInterceptingMessageProcessor.run(SedaStageInterceptingMessageProcessor.java:239) at org.mule.work.WorkerContext.run(WorkerContext.java:310) ... 3 more

    MuleSoft JIRA | 5 years ago | Jeroen Verellen
    java.lang.IllegalStateException: Only owner thread can write to message: Thread[connector.VM.mule.default.receiver.03,5,main]/Thread[sedaFlowCrash.stage1.01,5,main]
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    When using both a message enricher and a filter, together with an http request in Non Blocking mode, request becomes unresponsive. Attaching app that reproduces the issue. Expected: http request is successful Actual: http request is hung, and an exception is thrown ERROR 2015-07-06 12:41:43,657 [[enricher-issue].enricher-issue.01] org.mule.exception.DefaultMessagingExceptionStrategy: Caught exception in Exception Strategy: Execution of the expression "flowVars['match']=__object_for_enrichment" failed. org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "flowVars['match']=__object_for_enrichment" failed. at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:232) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:192) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.el.mvel.MVELExpressionLanguage.enrich(MVELExpressionLanguage.java:198) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.expression.DefaultExpressionManager.enrichTyped(DefaultExpressionManager.java:262) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.enricher.MessageEnricher.enrich(MessageEnricher.java:93) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.enricher.MessageEnricher$EnricherProcessor.processResponse(MessageEnricher.java:225) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.AbstractRequestResponseMessageProcessor$1.processReplyTo(AbstractRequestResponseMessageProcessor.java:104) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.execution.MessageProcessorNotificationExecutionInterceptor$1.processReplyTo(MessageProcessorNotificationExecutionInterceptor.java:79) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor.resume(NonBlockingProcessorExecutor.java:91) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor.access$100(NonBlockingProcessorExecutor.java:37) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor$NonBlockingProcessorExecutorReplyToHandler.processReplyTo(NonBlockingProcessorExecutor.java:111) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor.resume(NonBlockingProcessorExecutor.java:91) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor.access$100(NonBlockingProcessorExecutor.java:37) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.NonBlockingProcessorExecutor$NonBlockingProcessorExecutorReplyToHandler.processReplyTo(NonBlockingProcessorExecutor.java:111) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.execution.MessageProcessorNotificationExecutionInterceptor$1.processReplyTo(MessageProcessorNotificationExecutionInterceptor.java:79) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.AbstractNonBlockingMessageProcessor$NonBlockingCompletionHandler.onCompletion(AbstractNonBlockingMessageProcessor.java:88) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.processor.AbstractNonBlockingMessageProcessor$NonBlockingCompletionHandler.onCompletion(AbstractNonBlockingMessageProcessor.java:65) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.DefaultHttpRequester$1.onCompletion(DefaultHttpRequester.java:236) ~[mule-module-http-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.DefaultHttpRequester$1.onCompletion(DefaultHttpRequester.java:205) ~[mule-module-http-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient$WorkManagerSourceAsyncCompletionHandler.onCompleted(GrizzlyHttpClient.java:259) ~[mule-module-http-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient$WorkManagerSourceAsyncCompletionHandler.onCompleted(GrizzlyHttpClient.java:243) ~[mule-module-http-3.7.0.jar:3.7.0] at com.ning.http.client.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:55) ~[async-http-client-1.9.21.jar:?] at com.ning.http.client.providers.grizzly.AhcEventFilter.onHttpPacketParsed(AhcEventFilter.java:416) ~[async-http-client-1.9.21.jar:?] at org.glassfish.grizzly.http.HttpCodecFilter.decodeWithTransferEncoding(HttpCodecFilter.java:1274) ~[grizzly-http-2.3.21.jar:2.3.21] at org.glassfish.grizzly.http.HttpCodecFilter.handleRead(HttpCodecFilter.java:594) ~[grizzly-http-2.3.21.jar:2.3.21] at org.glassfish.grizzly.http.HttpClientFilter.handleRead(HttpClientFilter.java:175) ~[grizzly-http-2.3.21.jar:2.3.21] at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) ~[grizzly-framework-2.3.21.jar:2.3.21] at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.run0(FlowWorkManagerIOStrategy.java:134) ~[mule-module-http-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.access$100(FlowWorkManagerIOStrategy.java:31) ~[mule-module-http-3.7.0.jar:3.7.0] at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy$WorkerThreadRunnable.run(FlowWorkManagerIOStrategy.java:157) ~[mule-module-http-3.7.0.jar:3.7.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_11] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_11] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_11] Caused by: java.lang.IllegalStateException: Only owner thread can write to message: Thread[[enricher-issue].HTTP_Listener_Configuration.worker.01,5,main]/Thread[[enricher-issue].enricher-issue.01,5,main] at org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1784) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.DefaultMuleMessage.checkMutable(DefaultMuleMessage.java:1770) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.DefaultMuleMessage.assertAccess(DefaultMuleMessage.java:1699) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.DefaultMuleMessage.setProperty(DefaultMuleMessage.java:535) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.DefaultMuleMessage.setProperty(DefaultMuleMessage.java:529) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.el.context.MessagePropertyMapContext.put(MessagePropertyMapContext.java:49) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.el.context.MessagePropertyMapContext.put(MessagePropertyMapContext.java:17) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.mvel2.optimizers.impl.refl.nodes.MapAccessorNest.setValue(MapAccessorNest.java:67) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.optimizers.impl.refl.nodes.VariableAccessor.setValue(VariableAccessor.java:46) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:59) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.ast.AssignmentNode.getReducedValueAccelerated(AssignmentNode.java:111) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.MVELRuntime.execute(MVELRuntime.java:86) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.mvel2.MVEL.executeExpression(MVEL.java:943) ~[mule-mvel2-2.1.9-MULE-006.jar:?] at org.mule.el.mvel.MVELExpressionExecutor.execute(MVELExpressionExecutor.java:72) ~[mule-core-3.7.0.jar:3.7.0] at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:228) ~[mule-core-3.7.0.jar:3.7.0] ... 39 more

    MuleSoft JIRA | 2 years ago | Jesica Fera
    org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "flowVars['match']=__object_for_enrichment" failed.
  5. 0

    If the flow is configured with non-blocking processing strategy, when making a request inside an enricher an access violation Exception is thrown when the enricher tries to write the result in the target . {panel} ERROR 2015-09-24 14:07:10,765 [[enricher-issue-bug].enricher-issue.01] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Execution of the expression "flowVars['response']=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: BufferInputStream Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. Only owner thread can write to message: Thread[[enricher-issue-bug].HTTP_Listener_Configuration.worker.01,5,main]/Thread[[enricher-issue-bug].enricher-issue.01,5,main] (java.lang.IllegalStateException) org.mule.DefaultMuleMessage:1781 (null) 2. Execution of the expression "flowVars['response']=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException) org.mule.el.mvel.MVELExpressionLanguage:232 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html) 3. Execution of the expression "flowVars['response']=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: BufferInputStream (org.mule.api.MessagingException) org.mule.processor.NonBlockingProcessorExecutor$NonBlockingProcessorExecutorReplyToHandler:122 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.IllegalStateException: Only owner thread can write to message: Thread[[enricher-issue-bug].HTTP_Listener_Configuration.worker.01,5,main]/Thread[[enricher-issue-bug].enricher-issue.01,5,main] at org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1781) at org.mule.DefaultMuleMessage.checkMutable(DefaultMuleMessage.java:1767) at org.mule.DefaultMuleMessage.assertAccess(DefaultMuleMessage.java:1696) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** {panel} Attaching app to reproduce and logs

    MuleSoft JIRA | 2 years ago | Evangelina Martinez Ruiz Moreno
    java.lang.IllegalStateException: Only owner thread can write to message: Thread[[enricher-issue-bug].HTTP_Listener_Configuration.worker.01,5,main]/Thread[[enricher-issue-bug].enricher-issue.01,5,main]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Only owner thread can write to message: Thread[connector.http.mule.default.receiver.02,5,]/Thread[connector.http.mule.default.receiver.04,5,main]

      at org.mule.DefaultMuleMessage.newException()
    2. Mule Core
      DefaultMuleMessage.newException
      1. org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1574)
      1 frame