42wim / matterircd

Connect to your mattermost or slack using your IRC-client of choice.
MIT License
295 stars 60 forks source link

crash in MMClient.UpdateLastViewed #249

Closed Peter4825 closed 4 years ago

Peter4825 commented 5 years ago

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

goroutine 197 [running]: github.com/42wim/matterircd/vendor/github.com/42wim/matterbridge/matterclient.(MMClient).UpdateLastViewed(0xc000094630, 0xc00072c440, 0x1a, 0x1, 0xc0000e3601) /go/src/github.com/42wim/matterircd/vendor/github.com/42wim/matterbridge/matterclient/channels.go:202 +0x110 github.com/42wim/matterircd/mm-go-irckit.(User).antiIdle(0xc0007b1180, 0xc00072c440, 0x1a) /go/src/github.com/42wim/matterircd/mm-go-irckit/mmuser.go:670 +0x80 created by github.com/42wim/matterircd/mm-go-irckit.(*User).loginToMattermost /go/src/github.com/42wim/matterircd/mm-go-irckit/mmuser.go:98 +0x3cf

As usual, I have more logs if needed, contact me on irc :) Running version 0.19.2 091f927

vmiklos commented 4 years ago

I can reproduce this one. It seems this happens when there is a network error between matterircd and the MM server. I typically don't have an up to date build from git master when this happens, but today I had 2 network errors in a row, so now I could reproduce it with the latest version.

Jun 18 14:32:11 plug3 matterircd[31581]: panic: runtime error: invalid memory address or nil pointer dereference
Jun 18 14:32:11 plug3 matterircd[31581]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x41dbc0]
Jun 18 14:32:11 plug3 matterircd[31581]: goroutine 16 [running]:
Jun 18 14:32:11 plug3 matterircd[31581]: github.com/42wim/matterircd/vendor/github.com/42wim/matterbridge/matterclient.(*MMClient).UpdateLastViewed(0x40001408f0, 0x40002dc5c0, 0x1a, 0x1, 0x40001d4101)
Jun 18 14:32:11 plug3 matterircd[31581]:         /go/src/github.com/42wim/matterircd/vendor/github.com/42wim/matterbridge/matterclient/channels.go:220 +0xd0
Jun 18 14:32:11 plug3 matterircd[31581]: github.com/42wim/matterircd/mm-go-irckit.(*User).antiIdle(0x40002aa000, 0x40002dc5c0, 0x1a)
Jun 18 14:32:11 plug3 matterircd[31581]:         /go/src/github.com/42wim/matterircd/mm-go-irckit/mmuser.go:687 +0x5c
Jun 18 14:32:11 plug3 matterircd[31581]: created by github.com/42wim/matterircd/mm-go-irckit.(*User).loginToMattermost
Jun 18 14:32:11 plug3 matterircd[31581]:         /src/github.com/42wim/matterircd/mm-go-irckit/mmuser.go:98 +0x334

version 0.19.5-dev 7df0850e461813ec895bffa104ff64e3418e643d

@42wim if you can provide some code pointers, I don't mind taking a look at this myself. Like, what would be the correct fix here, just hunt down the null pointer and do a minimal fix or is there a deeper problem here?

42wim commented 4 years ago

@vmiklos sorry for the long delay, I've now fixed it during my refactor. I would appreciate it if you can try to reproduce it though.

vmiklos commented 4 years ago

Thanks! I just updated, will comment if I see problems on the next network error (sadly this is not a VM, so it's not easy to stimulate this.) I also noticed a crash when disconnecting, but I'll file a separate issue for that.