Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: fix setHeapProfileTracker panic on Windows #17226

Merged
merged 4 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ func main() {
}
setGlobalVars()
setCPUAffinity()
setHeapProfileTracker()
setupLog()
setHeapProfileTracker()
setupTracing() // Should before createServer and after setup config.
printInfo()
setupBinlogClient()
Expand Down
7 changes: 4 additions & 3 deletions util/profile/trackerRecorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ package profile
import (
"time"

"github.com/pingcap/log"
"github.com/pingcap/tidb/util/kvcache"
log "github.com/sirupsen/logrus"
"go.uber.org/zap"
)

var col = &Collector{}
Expand All @@ -32,7 +33,7 @@ func HeapProfileForGlobalMemTracker(d time.Duration) {
case <-t.C:
err := heapProfileForGlobalMemTracker()
if err != nil {
log.Warnf("profile memory into tracker failed, err: %v", err)
log.Warn("profile memory into tracker failed", zap.Error(err))
}
}
}
Expand All @@ -45,7 +46,7 @@ func heapProfileForGlobalMemTracker() error {
}
defer func() {
if p := recover(); p != nil {
log.Warnf("GlobalLRUMemUsageTracker meet panic: %s", p)
log.Error("GlobalLRUMemUsageTracker meet panic", zap.Any("panic", p), zap.Stack("stack"))
}
}()
kvcache.GlobalLRUMemUsageTracker.ReplaceBytesUsed(bytes)
Expand Down