Concurrent Modification Exception when executing workflow

Hello,

I am getting the following error in the logs of my Java application which uses Temporal Java SDK:


java.util.ConcurrentModificationException: null
	at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1605)
	at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1628)
	at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler$LocalActivityMeteringHelper.newWFTStarting(ReplayWorkflowRunTaskHandler.java:431)
	at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler$LocalActivityMeteringHelper.access$200(ReplayWorkflowRunTaskHandler.java:425)
	at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTask(ReplayWorkflowRunTaskHandler.java:143)
	at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithQuery(ReplayWorkflowTaskHandler.java:133)
	at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:98)
	at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handleTask(WorkflowWorker.java:413)
	at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:320)
	at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:261)
	at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:105)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Most of the time (but not always) the workflow gets stuck on this, but still it gets printed to the logs every few seconds.

In my workflow I am using two lists to keep track of the state. I have a few local activities that run in a loop until the processing is done.

I am using SDK version 1.22.3.

Do you know what might be causing this? Could it be a configuration issue on my side?

Thanks!

We are looking into this.

Confirmed this is a bug in the Java SDK. We have opened an issue and it should be resolved for the next Java SDK release that we are targeting for next week.

1 Like

Thank you for your quick response!