mirror of https://github.com/jetkvm/kvm.git
feat: add failsafe reason for video max restart attempts reached
This commit is contained in:
parent
641b03199e
commit
0ef94db8e7
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/jetkvm/kvm/internal/supervisor"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -78,6 +80,10 @@ func checkFailsafeReason() {
|
||||||
|
|
||||||
// TODO: read the goroutine stack trace and check which goroutine is panicking
|
// TODO: read the goroutine stack trace and check which goroutine is panicking
|
||||||
failsafeModeActive = true
|
failsafeModeActive = true
|
||||||
|
if strings.Contains(failsafeCrashLog, supervisor.FailsafeReasonVideoMaxRestartAttemptsReached) {
|
||||||
|
failsafeModeReason = "video"
|
||||||
|
return
|
||||||
|
}
|
||||||
if strings.Contains(failsafeCrashLog, "runtime.cgocall") {
|
if strings.Contains(failsafeCrashLog, "runtime.cgocall") {
|
||||||
failsafeModeReason = "video"
|
failsafeModeReason = "video"
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
|
"github.com/jetkvm/kvm/internal/supervisor"
|
||||||
"github.com/jetkvm/kvm/internal/utils"
|
"github.com/jetkvm/kvm/internal/utils"
|
||||||
"github.com/rs/zerolog"
|
"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()
|
logger := p.logger.With().Uint("attempt", p.restarts).Uint("maxAttempts", p.options.MaxRestartAttempts).Logger()
|
||||||
|
|
||||||
if p.restarts >= p.options.MaxRestartAttempts {
|
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")
|
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
|
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
|
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
|
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