quickfeed / helpbot

A discord bot to help teaching assistants keep track of students who need help
MIT License
3 stars 2 forks source link

Segmentation fault #5

Closed r0qs closed 3 years ago

r0qs commented 3 years ago

Running the bot in a server for the dat520 course, the bot crashed with the following error when performing the student's registration:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc8d311]

goroutine 906 [running]:
github.com/Raytar/helpbot.(*HelpBot).registerCommand(0xc000130540, 0xc000499680)
    /src/command.go:488 +0xcb1
github.com/Raytar/helpbot.(*HelpBot).discordMessageCreate(0xc000130540, 0x11c2c20, 0xc0001cd4a0, 0xc000499680)
    /src/event.go:55 +0x57d
github.com/andersfylling/disgord.(*dispatcher).trigger(0xc0002868c0, 0xeea900, 0xc0004c5a80, 0xf9fde0, 0xc000499680)
    /go/pkg/mod/github.com/andersfylling/disgord@v0.18.0/reactor_gen.go:467 +0x4d4
github.com/andersfylling/disgord.(*dispatcher).dispatch(0xc0002868c0, 0x11b0120, 0xc000038010, 0xc00020c8a0, 0xe, 0xf9fde0, 0xc000499680)
    /go/pkg/mod/github.com/andersfylling/disgord@v0.18.0/reactor.go:154 +0x329
created by github.com/andersfylling/disgord.demultiplexer
    /go/pkg/mod/github.com/andersfylling/disgord@v0.18.0/reactor.go:76 +0x279

I couldn't reproduce the error locally. After the crash, the boot cannot be restarted, crashing everytime with the following:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xc8eb46]

goroutine 1 [running]:
github.com/andersfylling/disgord/std.(*msgFilter).SetPrefix(...)
    /go/pkg/mod/github.com/andersfylling/disgord@v0.18.0/std/msgfilter.go:47
github.com/Raytar/helpbot.(*HelpBot).initEvents(0xc000128540)
    /src/event.go:14 +0xc6
github.com/Raytar/helpbot.New(0xc0000bd9c0, 0x3b, 0xc000284860, 0xe, 0xc00029a1b0, 0x28, 0xc000284a60, 0x1, 0xad5eba437000015, 0xae81c96b7d20014, ...)
    /src/helpbot.go:59 +0x1f6
main.main()
    /src/cmd/helpbot/main.go:53 +0x318

Is this a know problem? I'm wondering if the problem is due to some miss configuration and the bot couldn't not access the organization and the code did not handle such case properly.

r0qs commented 3 years ago

The bot is return nil for the autograder when it is not running on the same server. This limitation will be address in the future, so this issue can be closed by now.