mirror of https://github.com/jetkvm/kvm.git
feat: add failsafe reason for video max restart attempts reached (#991)
This commit is contained in:
parent
641b03199e
commit
d34d01c4b3
|
|
@ -5,6 +5,8 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/jetkvm/kvm/internal/supervisor"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -78,6 +80,10 @@ func checkFailsafeReason() {
|
|||
|
||||
// TODO: read the goroutine stack trace and check which goroutine is panicking
|
||||
failsafeModeActive = true
|
||||
if strings.Contains(failsafeCrashLog, supervisor.FailsafeReasonVideoMaxRestartAttemptsReached) {
|
||||
failsafeModeReason = "video"
|
||||
return
|
||||
}
|
||||
if strings.Contains(failsafeCrashLog, "runtime.cgocall") {
|
||||
failsafeModeReason = "video"
|
||||
return
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/jetkvm/kvm/internal/supervisor"
|
||||
"github.com/jetkvm/kvm/internal/utils"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
|
@ -422,7 +423,7 @@ func (p *NativeProxy) restartProcess() error {
|
|||
logger := p.logger.With().Uint("attempt", p.restarts).Uint("maxAttempts", p.options.MaxRestartAttempts).Logger()
|
||||
|
||||
if p.restarts >= p.options.MaxRestartAttempts {
|
||||
logger.Fatal().Msg("max restart attempts reached, exiting")
|
||||
logger.Fatal().Msgf("max restart attempts reached, exiting: %s", supervisor.FailsafeReasonVideoMaxRestartAttemptsReached)
|
||||
return fmt.Errorf("max restart attempts reached")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,6 @@ const (
|
|||
ErrorDumpDir = "/userdata/jetkvm/crashdump" // The error dump directory is the directory where the error dumps are stored
|
||||
ErrorDumpLastFile = "last-crash.log" // The error dump last file is the last error dump file
|
||||
ErrorDumpTemplate = "jetkvm-%s.log" // The error dump template is the template for the error dump file
|
||||
|
||||
FailsafeReasonVideoMaxRestartAttemptsReached = "failsafe::video.max_restart_attempts_reached"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue