Open mr-khabib opened 1 year ago
Periodically I'm getting ConcurrentModificationException/IllegalStateException while using Declarative fsm's.
I was able to partially reproduce with this UT:
@Test public void testRaceForUntypedStateMachine() { final CountDownLatch eventCondition = new CountDownLatch(5); StateMachineBuilder<DeclarativeStateMachine, TestState, TestEvent, Integer> bmyBuilder = StateMachineBuilderFactory.<DeclarativeStateMachine, TestState, TestEvent, Integer> create(DeclarativeStateMachineImpl.class, TestState.class, TestEvent.class, Integer.class, DeclarativeStateMachine.class); Thread thr1 = new Thread(new Runnable() { @Override public void run() { while(true) { DeclarativeStateMachine fsm1 = bmyBuilder.newStateMachine(TestState.A, monitor); fsm1.fire(TestEvent.InternalA, null); } } }, "Test-Thread-1"); Thread thr2 = new Thread(new Runnable() { @Override public void run() { while(true) { DeclarativeStateMachine fsm2 = bmyBuilder.newStateMachine(TestState.A, monitor); fsm2.fire(TestEvent.InternalA, null); } } }, "Test-Thread-2"); try { thr1.start(); thr2.start(); eventCondition.await(2, TimeUnit.SECONDS); TimeUnit.MILLISECONDS.sleep(100); } catch (InterruptedException e) { fail(); } }
Issue reproduce in unpredictable manner - some time every run of this test, some time it needed to be run 10 times to get this state
Periodically I'm getting ConcurrentModificationException/IllegalStateException while using Declarative fsm's.
I was able to partially reproduce with this UT:
Issue reproduce in unpredictable manner - some time every run of this test, some time it needed to be run 10 times to get this state