Skip to content

Commit

Permalink
MM-27887: set traceback to crash from code (#15274)
Browse files Browse the repository at this point in the history
Unless we set traceback level to crash, goroutines from all threads aren't printed.
See: golang/go#13161.

This is important because SIGQUIT traces will miss on goroutines.

https://mattermost.atlassian.net/browse/MM-27887
  • Loading branch information
agnivade committed Aug 17, 2020
1 parent f16fb6f commit d48eec6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/mattermost/commands/server.go
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"os"
"os/signal"
"runtime/debug"
"syscall"

"github.com/mattermost/mattermost-server/v5/api4"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d48eec6

Please sign in to comment.