fix: delete globalProfiler should lock (#16697)

This commit is contained in:
jiuker
2023-02-25 10:37:44 +08:00
committed by GitHub
parent e05f3d5d84
commit 6e8960ccdd

View File

@@ -803,6 +803,8 @@ func (a adminAPIHandlers) ProfileHandler(w http.ResponseWriter, r *http.Request)
for {
select {
case <-ctx.Done():
globalProfilerMu.Lock()
defer globalProfilerMu.Unlock()
for k, v := range globalProfiler {
v.Stop()
delete(globalProfiler, k)