sleeyax / aternos-discord-bot

Discord bot to start & stop a Minecraft server automatically
https://hub.docker.com/r/sleeyax/aternos-discord-bot/tags
MIT License
79 stars 93 forks source link

[BUG] Segmentation violation #30

Closed sleeyax closed 2 years ago

sleeyax commented 2 years ago

In production I'm noticing pods sometimes restart automatically due to the following error:

2022/05/11 10:47:51 worker xxx: Server is offline
2022/05/11 10:47:51 Receiver Channel Closed! Exiting....
2022/05/11 10:47:51 worker xxx: Background routines stopped & connections closed
2022/05/11 10:47:51 worker xx: Max number of websocket connection retries reached.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xa3c8a7]

goroutine 57537 [running]:
github.com/sleeyax/aternos-api.(*Websocket).Close(0x0)
        /go/pkg/mod/github.com/sleeyax/aternos-api@v0.3.0/websocket.go:50 +0x47
github.com/sleeyax/aternos-discord-bot/worker.(*Worker).On.func1()
        /app/worker/worker.go:58 +0x4e
github.com/sleeyax/aternos-discord-bot/worker.(*Worker).On(0xc001573ef0, {0xf170d0, 0xc0018c1c00}, 0xc001ecfc00)
        /app/worker/worker.go:70 +0x9c4
created by github.com/sleeyax/aternos-discord-bot.(*Bot).handleCommands
        /app/command_handler.go:128 +0xb9b

I should investigate the cause of this to make sure the pod keeps running indefinitely.