MattIPv4 / DNS-over-Discord

1.1.1.1 works from a Discord server, thanks to the 1.1.1.1 bot. Invite the bot to your Discord server to start using DNS over Discord.
https://dns-over-discord.v4.wtf/invite
Apache License 2.0
281 stars 28 forks source link

Resolve panic in production caused by cache config #9

Closed MattIPv4 closed 4 years ago

MattIPv4 commented 4 years ago

Recently the bot moved to using disgord and initially used a cache config disabling all caches within the bot, as it only needs to respond to messages on-demand without anything being held in the cache.

However, in the production environment, this cache config resulted in the bot panicking and exiting. Commenting out the cache config resolve this for now but results in more memory usage for the bot.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x7789d7]

goroutine 52 [running]:
github.com/andersfylling/disgord.(*Cache).UpdateMemberAndUser(0xc000118330, 0x530f8633f820003, 0x8e2734314800029, 0xc0008062c0, 0x14f, 0x160)
        C:/Users/Administrator/go/pkg/mod/github.com/andersfylling/disgord@v0.17.3/cache.go:783 +0x57
github.com/andersfylling/disgord.cacheEvent(0x9a71e0, 0xc000118330, 0xc0001503e0, 0x13, 0x879ae0, 0xc0000da230, 0xc0008062c0, 0x14f, 0x160, 0x0, ...)
        C:/Users/Administrator/go/pkg/mod/github.com/andersfylling/disgord@v0.17.3/events.go:109 +0x184c
github.com/andersfylling/disgord.demultiplexer(0xc0000d2940, 0xc000108420, 0xc000118330)
        C:/Users/Administrator/go/pkg/mod/github.com/andersfylling/disgord@v0.17.3/reactor.go:73 +0x207
created by github.com/andersfylling/disgord.(*Client).setupConnectEnv
        C:/Users/Administrator/go/pkg/mod/github.com/andersfylling/disgord@v0.17.3/client.go:393 +0x216

(Yes, production is a Windows server environment, don't @ me)