Project: mule
Issue MULE-7912: Thread exception when registering mule notification listeners
I created an app that contains a bean that registers mule notification listeners. Those listeners log some attributes of the mule message (never write something in the mule message). They might or might not run in a separate thread (that does not make the difference). If that bean is enabled, we get this exception: java.lang.IllegalStateException: Only owner thread can write to message: Thread[pool-12-thread-1,5,main]/Thread[[releasesmoketest-final].automatedRun.stage1.02,5,main] org.mule.DefaultMuleMessage.newException(DefaultMuleMessage.java:1662) org.mule.DefaultMuleMessage.checkMutable(DefaultMuleMessage.java:1648) org.mule.DefaultMuleMessage.assertAccess(DefaultMuleMessage.java:1577) org.mule.DefaultMuleMessage.setExceptionPayload(DefaultMuleMessage.java:999) org.mule.exception.AbstractMessagingExceptionStrategy.handleException(AbstractMessagingExceptionStrategy.java:64) org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:37) org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14) org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54) org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44) org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50) org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40) org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41) org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48) org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28) org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13) org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:109) org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30) org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:182) org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:36) org.mule.work.WorkerContext.run(WorkerContext.java:286) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:745)
Story points: 2