Skip to content

Commit

Permalink
watchdog: add LOTUS_DISABLE_WATCHDOG escape hatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Dec 3, 2020
1 parent d033f8a commit f9cbf6d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions node/modules/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"io"
"io/ioutil"
"os"
"time"

"github.com/gbrlsnchs/jwt/v3"
Expand All @@ -30,6 +31,13 @@ import (
"github.com/raulk/go-watchdog"
)

const (
// EnvWatchdogDisabled is an escape hatch to disable the watchdog explicitly
// in case an OS/kernel appears to report incorrect information. The
// watchdog will be disabled if the value of this env variable is 1.
EnvWatchdogDisabled = "LOTUS_DISABLE_WATCHDOG"
)

const (
JWTSecretName = "auth-jwt-private" //nolint:gosec
KTJwtHmacSecret = "jwt-hmac-secret" //nolint:gosec
Expand Down Expand Up @@ -62,6 +70,11 @@ func MemoryConstraints() system.MemoryConstraints {
// MemoryWatchdog starts the memory watchdog, applying the computed resource
// constraints.
func MemoryWatchdog(lc fx.Lifecycle, constraints system.MemoryConstraints) {
if os.Getenv(EnvWatchdogDisabled) == "1" {
log.Infof("memory watchdog is disabled via %s", EnvWatchdogDisabled)
return
}

cfg := watchdog.MemConfig{
Resolution: 5 * time.Second,
Policy: &watchdog.WatermarkPolicy{
Expand Down

0 comments on commit f9cbf6d

Please sign in to comment.