Skip to content
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

Merged
merged 4 commits into from
Aug 18, 2024

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Aug 17, 2024

  • systemd per discord gophers reco
  • avoid crashes with "abc" * 10_000_000_000 - no more fatal error: runtime: out of memory instead a nice:
panic: would exceed memory requesting 1875000000 objects, 1072372592 free
  • limit length of values in autosave .gr to 1000 (per)

@ldemailly ldemailly changed the title Harden the service Harden the service, use the memory limit from grol 0.51+ Aug 18, 2024
@ldemailly ldemailly changed the title Harden the service, use the memory limit from grol 0.51+ Harden the service, use the memory limit from grol 0.51+ to avoid fatal/crashes Aug 18, 2024
@ldemailly ldemailly changed the title Harden the service, use the memory limit from grol 0.51+ to avoid fatal/crashes Harden the service, use the memory limit from grol 0.51+ to avoid fatal/crashes, limit length of values in state file Aug 18, 2024
@ldemailly ldemailly requested a review from ccoVeille August 18, 2024 19:39
@ldemailly ldemailly merged commit df4515b into main Aug 18, 2024
1 check passed
@ldemailly ldemailly deleted the ldemailly-patch-1 branch August 18, 2024 19:39
@@ -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")

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

Copy link
Member Author

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)

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

Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants