java.util.concurrent.RejectedExecutionException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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
    via by Jeroen Verellen,
  • 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
    via by Jeroen Verellen,
    • 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)
    No Bugmate found.