Error in workflow after a long await

Hi,

I have a workflow set up running with a while true loop within it having 4 activities and an await() state.
if the await state is small like around 5 min, the workflow is executed properly every 5 min .

But when the await() is longer like 15hr after some time like 10hr below error is thrown in the slacktrace

  1. What are the possible scenarios that this error can be thrown
  2. If anyone else faced with this error, how is this resolved

3 INVALID_ARGUMENT: io.temporal.internal.replay.InternalWorkflowTaskException: Failure handling event 28 of 'EVENT_TYPE_TIMER_STARTED' type. IsReplaying=true, PreviousStartedEventId=26, workflowTaskStartedEventId=0, Currently Processing StartedEventId=26 at io.temporal.internal.statemachines.WorkflowStateMachines.handleEvent(WorkflowStateMachines.java:193) at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleEvent(ReplayWorkflowRunTaskHandler.java:140) at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTaskImpl(ReplayWorkflowRunTaskHandler.java:180) at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleQueryWorkflowTask(ReplayWorkflowRunTaskHandler.java:255) at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleQueryOnlyWorkflowTask(ReplayWorkflowTaskHandler.java:258) at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:112) at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:309) at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:275) at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:73) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: Event 28 of EVENT_TYPE_TIMER_STARTED does not match command COMMAND_TYPE_SCHEDULE_ACTIVITY_TASK at io.temporal.internal.statemachines.WorkflowStateMachines.handleCommandEvent(WorkflowStateMachines.java:263) at io.temporal.internal.statemachines.WorkflowStateMachines.handleEventImpl(WorkflowStateMachines.java:199) at io.temporal.internal.statemachines.WorkflowStateMachines.handleEvent(WorkflowStateMachines.java:178) ... 11 more

What is the Java SDK version?
Was the code updated during the 10 hour window?
If you could share code and post the event history (or DM me directly) it would also help.

The problem was in breaking determinism by using DateUtils.getCurrTime() which in turn called LocalDateTime.now(zoneId).

According to Workflow Implementation Constraints only time returned by Workflow.currentTimeMillis can be used inside the workflow code.