-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden the service, use the memory limit from grol 0.51+ to avoid fatal/crashes, limit length of values in state file #80
Conversation
@@ -18,5 +23,9 @@ func main() { | |||
log.Fatalf("DISCORD_BOT_TOKEN must be set") | |||
} | |||
AutoLoadSave = !(os.Getenv("GROL_DISABLE_AUTOSAVE") == "1") | |||
memlimit := debug.SetMemoryLimit(-1) | |||
if memlimit == math.MaxInt64 { | |||
log.Fatalf("Memory limit not set, please set GOMEMLIMIT=1GiB or similar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about adding information it's about an env variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but I figured the only operator of the bot which is me knows what GOMEMLIMIT= implies :)
@@ -18,5 +23,9 @@ func main() { | |||
log.Fatalf("DISCORD_BOT_TOKEN must be set") | |||
} | |||
AutoLoadSave = !(os.Getenv("GROL_DISABLE_AUTOSAVE") == "1") | |||
memlimit := debug.SetMemoryLimit(-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sane remarka comment would help as this method is uncommon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also have to know (it's in the doc too) that the default value is MaxInt64
fatal error: runtime: out of memory
instead a nice: