Skip to content

Commit

Permalink
Prevent cache eviction race (#1013)
Browse files Browse the repository at this point in the history
In some server tests the race detector noticed that
SetPreviousStartedEventID can race with cache removal which happens on
the cache eviction thread.
  • Loading branch information
Matt McShane authored Jan 27, 2023
1 parent 1fe6824 commit 3b37e0f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/internal_task_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ func (w *workflowExecutionContextImpl) SetCurrentTask(task *workflowservice.Poll
}

func (w *workflowExecutionContextImpl) SetPreviousStartedEventID(eventID int64) {
w.mutex.Lock() // This call can race against the cache eviction thread - see clearState
defer w.mutex.Unlock()
w.previousStartedEventID = eventID
}

Expand Down

0 comments on commit 3b37e0f

Please sign in to comment.