Print stack trace of all goroutines when emergency halting if verbose
This commit is contained in:
@@ -6,6 +6,7 @@ import "log"
|
|||||||
import "io/fs"
|
import "io/fs"
|
||||||
import "errors"
|
import "errors"
|
||||||
import "context"
|
import "context"
|
||||||
|
import "runtime"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
import "git.tebibyte.media/sashakoshka/go-cli"
|
import "git.tebibyte.media/sashakoshka/go-cli"
|
||||||
@@ -273,6 +274,11 @@ func (this *environment) phase80Shutdown() bool {
|
|||||||
<- ctx.Done()
|
<- ctx.Done()
|
||||||
if errors.Is(context.Cause(ctx), context.DeadlineExceeded) {
|
if errors.Is(context.Cause(ctx), context.DeadlineExceeded) {
|
||||||
log.Println("XXX (80) shutdown timeout expired, performing emergency halt")
|
log.Println("XXX (80) shutdown timeout expired, performing emergency halt")
|
||||||
|
if Verb() {
|
||||||
|
dumpBuffer := make([]byte, 8192)
|
||||||
|
runtime.Stack(dumpBuffer, true)
|
||||||
|
log.Printf("XXX (80) stack trace of all goroutines:\n%s", dumpBuffer)
|
||||||
|
}
|
||||||
log.Printf("====== [%s] END =======", this.name)
|
log.Printf("====== [%s] END =======", this.name)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user