diff --git a/util/execdetails/execdetails.go b/util/execdetails/execdetails.go index a5a603b447947..f54614a0b434c 100644 --- a/util/execdetails/execdetails.go +++ b/util/execdetails/execdetails.go @@ -911,6 +911,7 @@ func NewRuntimeStatsColl(reuse *RuntimeStatsColl) *RuntimeStatsColl { // RegisterStats register execStat for a executor. func (e *RuntimeStatsColl) RegisterStats(planID int, info RuntimeStats) { e.mu.Lock() + defer e.mu.Unlock() stats, ok := e.rootStats[planID] if !ok { stats = NewRootRuntimeStats() @@ -928,7 +929,6 @@ func (e *RuntimeStatsColl) RegisterStats(planID int, info RuntimeStats) { if !found { stats.groupRss = append(stats.groupRss, info.Clone()) } - e.mu.Unlock() } // GetBasicRuntimeStats gets basicRuntimeStats for a executor.