Crash when disconnecting without a login
Closed this issue · 1 comments
vmiklos commented
Steps to reproduce:
-
Connect to matterircd.
-
Try to login with an expired/invalid token.
-
Disconnect.
Expected result: matterircd keeps running so a reconnect + login with a new token is possible.
Actual result:
$ ./matterircd --bind 127.0.0.1:6668
INFO[2020-08-14T09:13:02+02:00] Running version 0.20.0-dev module=matterircd
INFO[2020-08-14T09:13:02+02:00] WARNING: THIS IS A DEVELOPMENT VERSION. Things may break. module=matterircd
INFO[2020-08-14T09:13:02+02:00] Listening on 127.0.0.1:6668 module=matterircd
INFO[2020-08-14T09:13:05+02:00] New connection: 127.0.0.1:58470 module=matterircd
loggerlevel: info
INFO[0006] login as vmiklos (team: ...) on ...
[0006] INFO matterclient: Found version 5.22.0.dev.5c89b8de75ffefb58e1672e7d6457246.false
ERRO[0006] login failed: Invalid or expired session, please login again.,
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x5b2f48]
goroutine 20 [running]:
github.com/42wim/matterircd/mm-go-irckit.CmdQuit(0x8bc040, 0x40001ee8f0, 0x40001ee9c0, 0x4000535590, 0x40002742d0, 0x1)
/home/vmiklos/git/go/src/github.com/42wim/matterircd/mm-go-irckit/server_commands.go:398 +0xd0
github.com/42wim/matterircd/mm-go-irckit.commands.Run(0x40001e32f0, 0x8bc040, 0x40001ee8f0, 0x40001ee9c0, 0x4000535590, 0x533c5c, 0x4000094058)
/home/vmiklos/git/go/src/github.com/42wim/matterircd/mm-go-irckit/commands.go:55 +0xf0
github.com/42wim/matterircd/mm-go-irckit.(*server).handle.func1(0x40001ee8f0, 0x40001ee9c0, 0x4000535590)
/home/vmiklos/git/go/src/github.com/42wim/matterircd/mm-go-irckit/server.go:347 +0x54
created by github.com/42wim/matterircd/mm-go-irckit.(*server).handle
/home/vmiklos/git/go/src/github.com/42wim/matterircd/mm-go-irckit/server.go:346 +0xcc
I guess the fix is to improve CmdQuit(), so it checks for nil u
and/or u.br
. Is that enough or there is some deeper problem there?
vmiklos commented
Just handling nil u.br
works, as far as I see.