Skip to content

Commit c943d2a

Browse files
authored
panic from event handler (#337)
1 parent 9d150a0 commit c943d2a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/internal_event_handlers.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,18 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent(
436436
if event == nil {
437437
return nil, errors.New("nil event provided")
438438
}
439+
defer func() {
440+
if p := recover(); p != nil {
441+
weh.metricsScope.Counter(metrics.DecisionTaskPanicCounter).Inc(1)
442+
topLine := fmt.Sprintf("process event for %s [panic]:", weh.workflowInfo.TaskListName)
443+
st := getStackTraceRaw(topLine, 7, 0)
444+
weh.logger.Error("ProcessEvent panic.",
445+
zap.String("PanicError", fmt.Sprintf("%v", p)),
446+
zap.String("PanicStack", st))
447+
448+
weh.Complete(nil, newPanicError(p, st))
449+
}
450+
}()
439451

440452
weh.isReplay = isReplay
441453
traceLog(func() {

0 commit comments

Comments
 (0)