mattermost-community / focalboard

Focalboard is an open source, self-hosted alternative to Trello, Notion, and Asana.
https://www.focalboard.com
Other
21.63k stars 1.93k forks source link

Bug: Plugin crashes when DM channel name contains users who aren't found #1363

Closed chenilim closed 3 years ago

chenilim commented 3 years ago

Steps to reproduce the behavior

  1. See [this thread]

Server logs:

{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"panic: runtime error: invalid memory address or nil pointer dereference","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1adaba7]","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"goroutine 96 [running]:","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer.(*MattermostAuthLayer).userWorkspacesFromRows(0xc000596660, 0xc0000d6680, 0xc0000d6680, 0x0, 0x0, 0xc0004a6500, 0x1ddbc80)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/services/store/mattermostauthlayer/mattermostauthlayer.go:438 +0xa07","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/services/store/mattermostauthlayer.(*MattermostAuthLayer).GetUserWorkspaces(0xc000596660, 0xc0005b8540, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/services/store/mattermostauthlayer/mattermostauthlayer.go:381 +0x905","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/app.(*App).GetUserWorkspaces(...)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/app/workspaces.go:65","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/api.(*API).handleGetUserWorkspaces(0xc00009cd80, 0x1f99080, 0xc00059c260, 0xc00021f100)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/api/api.go:1468 +0xa8","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/api.(*API).attachSession.func1(0x1f99080, 0xc00059c260, 0xc00021f000)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/api/auth.go:416 +0xa09","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"net/http.HandlerFunc.ServeHTTP(0xc0003e7600, 0x1f99080, 0xc00059c260, 0xc00021f000)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/net/http/server.go:2042 +0x44","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/mattermost/focalboard/server/api.(*API).requireCSRFToken.func1(0x1f99080, 0xc00059c260, 0xc00021f000)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/server/api/api.go:116 +0x1f2","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"net/http.HandlerFunc.ServeHTTP(0xc000a8dee0, 0x1f99080, 0xc00059c260, 0xc00021f000)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/net/http/server.go:2042 +0x44","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"github.com/gorilla/mux.(*Router).ServeHTTP(0xc000166840, 0x1f99080, 0xc00059c260, 0xc00021ec00)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.028 -04:00","level":"debug","msg":"\t/home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0xd3","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"main.(*Plugin).ServeHTTP(0xc000090240, 0xc000533ce0, 0x1f99080, 0xc00059c260, 0xc00021ec00)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/home/runner/work/focalboard/focalboard/mattermost-plugin/server/plugin.go:178 +0x6c","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"github.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ServeHTTP(0xc0004a6600, 0xc000a8d3a0, 0x26d1620, 0x0, 0x0)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/home/runner/go/pkg/mod/github.com/mattermost/mattermost-server/v5@v5.3.2-0.20210621071817-df224571d8a1/plugin/client_rpc.go:447 +0x2b2","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"reflect.Value.call(0xc000091440, 0xc000098830, 0x13, 0x1df9b93, 0x4, 0xc000319f08, 0x3, 0x3, 0x0, 0x7942800, ...)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/reflect/value.go:476 +0x8c7","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"reflect.Value.Call(0xc000091440, 0xc000098830, 0x13, 0xc00051d708, 0x3, 0x3, 0xc00051d6a0, 0x2, 0x0)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/reflect/value.go:337 +0xb9","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"net/rpc.(*service).call(0xc00009c340, 0xc0004b47d0, 0xc0004fe780, 0xc0004fe790, 0xc000290200, 0xc00000cb60, 0x1be2760, 0xc000a8d3a0, 0x16, 0x1bf93e0, ...)","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/net/rpc/server.go:377 +0x189","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"created by net/rpc.(*Server).ServeCodec","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}
{"timestamp":"2021-09-28 16:14:24.029 -04:00","level":"debug","msg":"\t/opt/hostedtoolcache/go/1.15.15/x64/src/net/rpc/server.go:474 +0x445","caller":"plugin/hclog_adapter.go:54","plugin_id":"focalboard"}

Expected behavior

No crash

Edition and Platform

Additional context

This line of code is trying to dereference a nil pointer. It should handle that case gracefully.

chenilim commented 3 years ago

For now, suggest replacing missing users with "???" or similar token.