An error in a multi-instance is handled the same way as it would occur in a simple service-task: transaction is rolled back and process is back in the state it first was.

I assume you're referring to an "execution-listener" on the multi-instance serviceTask? AFAIK, there are called for every execution of the loop:

Take for example org.activiti.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior /** * Called when the wrapped {@link ActivityBehavior} calls the * {@link AbstractBpmnActivityBehavior#leave(ActivityExecution)} method. * Handles the completion of one instance, and executes the logic for the sequential behavior. */ public void leave(ActivityExecution execution) { callActivityEndListeners(execution);

If you are indeed referring to a execution-listener on the service-task, and you only see the end-execution-listeners executed once, please comment and perhaps include the bpmn20.xml file.

junit.framework.AssertionFailedError: expected:<3> but was:<4> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:283) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:71) at org.activiti.engine.test.bpmn.multiinstance.MultiInstanceTest.testSequentialServiceTasksWithListeners(MultiInstanceTest.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at org.activiti.engine.impl.test.PvmTestCase.runTest(PvmTestCase.java:75) at junit.framework.TestCase.runBare(TestCase.java:134) at org.activiti.engine.impl.test.AbstractActivitiTestCase.runBare(AbstractActivitiTestCase.java:90) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

My execution listener is added through the BPMNParseListener. Though, I see the variable values correctly, the end event is received by my listener only once after all the iterations.The end event is not received after each iteration.

Okay… Probabily the way the listener is added makes a difference. I looked into the behavior and will take this into account when fixing the related issue. Because listeners added in the process-definition do get fired x+1 times..