From d48eec67274ab9f10e8d11dfc9d5e1415e760d77 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Mon, 17 Aug 2020 22:08:25 +0530 Subject: [PATCH] MM-27887: set traceback to crash from code (#15274) Unless we set traceback level to crash, goroutines from all threads aren't printed. See: https://github.com/golang/go/issues/13161. This is important because SIGQUIT traces will miss on goroutines. https://mattermost.atlassian.net/browse/MM-27887 --- cmd/mattermost/commands/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/mattermost/commands/server.go b/cmd/mattermost/commands/server.go index 238018be3d8f7..34ffd2ae9321a 100644 --- a/cmd/mattermost/commands/server.go +++ b/cmd/mattermost/commands/server.go @@ -7,6 +7,7 @@ import ( "net" "os" "os/signal" + "runtime/debug" "syscall" "github.com/mattermost/mattermost-server/v5/api4" @@ -54,6 +55,11 @@ func serverCmdF(command *cobra.Command, args []string) error { } func runServer(configStore config.Store, disableConfigWatch bool, usedPlatform bool, interruptChan chan os.Signal) error { + // Setting the highest traceback level from the code. + // This is done to print goroutines from all threads (see golang.org/issue/13161) + // and also preserve a crash dump for later investigation. + debug.SetTraceback("crash") + options := []app.Option{ app.ConfigStore(configStore), app.RunJobs,