temporalio / temporalio/sdk-java

State machine exception during termination

Open
#1,457 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Actual Behavior

During a load test, the following exception happened once:

│ 19:42:15.247 [Workflow Executor taskQueue="xxx", namespace="yyy": 311] WARN  i.t.i.r.ReplayWorkflowTaskHandler - Workflow task processing failure. startedEventId=17, WorkflowId=89ecf1a │
│ io.temporal.internal.statemachines.InternalWorkflowTaskException: Failure handling event 19 of type 'EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED' during replay. {WorkflowTaskStartedEventId=17, CurrentStartedEventId=1 │
│     at io.temporal.internal.statemachines.WorkflowStateMachines.createEventProcessingException(WorkflowStateMachines.java:257)                                                                
│     at io.temporal.internal.statemachines.WorkflowStateMachines.handleEventsBatch(WorkflowStateMachines.java:236)                                                                                   
│     at io.temporal.internal.statemachines.WorkflowStateMachines.handleEvent(WorkflowStateMachines.java:208)                                                                                                
│     at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.applyServerHistory(ReplayWorkflowRunTaskHandler.java:208)                                                                                          
│     at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTaskImpl(ReplayWorkflowRunTaskHandler.java:192)                                                                                
│     at io.temporal.internal.replay.ReplayWorkflowRunTaskHandler.handleWorkflowTask(ReplayWorkflowRunTaskHandler.java:147)                                                                              
│     at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTaskWithQuery(ReplayWorkflowTaskHandler.java:132)                                                      
│     at io.temporal.internal.replay.ReplayWorkflowTaskHandler.handleWorkflowTask(ReplayWorkflowTaskHandler.java:97)                                                 
│     at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handleTask(WorkflowWorker.java:336)                                                                                     
│     at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:246)                                                                         
│     at io.temporal.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:188)                                                                                      
│     at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:93)                                                                   
│     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)                                          
│     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)                                            
│     at java.base/java.lang.Thread.run(Thread.java:829)                                                                                                                    
│ Caused by: java.lang.IllegalArgumentException: Unexpected event:event_id: 19                                                                              
│ event_time {                                                                                                                                              
│   seconds: 1664134935                                                                                                                              
│   nanos: 131416185                                                                                                                                 
│ }                                                                                                                                                                 
│ event_type: EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED                                                                          
│ version: 1023                                                                                                                                                
│ task_id: 186665257                                                                                                                                     
│ workflow_execution_terminated_event_attributes {                                                                                                 
│ }                                                                                                                                                                                  
│                                                                                                                                                                               
│     at io.temporal.internal.statemachines.WorkflowStateMachines.handleNonStatefulEvent(WorkflowStateMachines.java:521)                                       
│     at io.temporal.internal.statemachines.WorkflowStateMachines.handleSingleEvent(WorkflowStateMachines.java:282)                                                  
│     at io.temporal.internal.statemachines.WorkflowStateMachines.handleEventsBatch(WorkflowStateMachines.java:234)                                                 
│     ... 13 common frames omitted

The history of this execution wasn't saved, but there are two full normal histories of Parent and Child workflows from that test attached.
histories.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with WorkflowStateMachines.java, especially the event-handling paths shown in the stack trace, and compare the attached Parent and Child histories in histories.zip. Determine why EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED is rejected during replay; done means reproducing or explaining the failure and adding coverage for the identified case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.