panic in (*Status).ToClusterJson

Description

Found during load tests. Another related status crash was already fixed. This is the same thing, just happening in another method.

http: panic serving 172.31.33.154:11648: runtime error: invalid memory address or nil pointer dereference
goroutine 819694 [running]:
net/http.(*conn).serve.func1(0xc013ccf180)
net/http/server.go:1767 +0x139
panic(0x1a56b60, 0x2ee9b60)
runtime/panic.go:679 +0x1b2
encoding/json.(*encodeState).marshal.func1(0xc00bbe8b68)
encoding/json/encode.go:305 +0x9a
panic(0x1a56b60, 0x2ee9b60)
runtime/panic.go:679 +0x1b2
encoding/json.(*encodeState).string(0xc0222f8e00, 0x0, 0x1a, 0x1)
encoding/json/encode.go:895 +0x5d
encoding/json.stringEncoder(0xc0222f8e00, 0x198de60, 0xc01c1648f0, 0x198, 0x100)
encoding/json/encode.go:610 +0xd9
encoding/json.structEncoder.encode(0xc003ca5680, 0x5, 0x8, 0xc0035d0b10, 0xc0222f8e00, 0x1b6cba0, 0xc01c1648c0, 0x199, 0x740100)
encoding/json/encode.go:664 +0x306
encoding/json.ptrEncoder.encode(0xc0035d0b40, 0xc0222f8e00, 0x1a5eec0, 0xc01c1648c0, 0x16, 0x1a50100)
encoding/json/encode.go:810 +0xb1
encoding/json.(*encodeState).reflectValue(0xc0222f8e00, 0x1a5eec0, 0xc01c1648c0, 0x16, 0x100)
encoding/json/encode.go:337 +0x82
encoding/json.(*encodeState).marshal(0xc0222f8e00, 0x1a5eec0, 0xc01c1648c0, 0xc0001b0100, 0x0, 0x0)
encoding/json/encode.go:309 +0x10b
encoding/json.Marshal(0x1a5eec0, 0xc01c1648c0, 0x1a, 0x1a5eec0, 0xc01c1648c0, 0x98d576, 0xbfa1319f02e0017a)
encoding/json/encode.go:161 +0x52
github.com/mattermost/mattermost-server/v5/model.(*Status).ToClusterJson(...)
github.com/mattermost/mattermost-server/v5@/model/status.go:39
github.com/mattermost/mattermost-server/v5/app.(*App).AddStatusCache(0xc00c57c780, 0xc01c1648c0)
github.com/mattermost/mattermost-server/v5@/app/status.go:22 +0x9e
github.com/mattermost/mattermost-server/v5/app.(*App).SetStatusOnline(0xc00c57c780, 0xc00be2dac0, 0x1a, 0x0)
github.com/mattermost/mattermost-server/v5@/app/status.go:200 +0x194
github.com/mattermost/mattermost-server/v5/api4.createPost(0xc020c2b600, 0x2003c80, 0xc00adc0e00, 0xc00a476900)
github.com/mattermost/mattermost-server/v5@/api4/post.go:89 +0x730
github.com/mattermost/mattermost-server/v5/web.Handler.ServeHTTP(0xc000db3580, 0x1db27e0, 0x2b35780, 0xa, 0x10001, 0x0, 0x0, 0x2003c80, 0xc00adc0e00, 0xc00a476900)
github.com/mattermost/mattermost-server/v5@/web/handlers.go:212 +0x1e9a
github.com/NYTimes/gziphandler.GzipHandlerWithOpts.func1.1(0x2003700, 0xc01ac2cee0, 0xc00a476900)
github.com/NYTimes/gziphandler@v1.1.1/gzip.go:336 +0x23f
net/http.HandlerFunc.ServeHTTP(0xc003c5cd20, 0x2003700, 0xc01ac2cee0, 0xc00a476900)
net/http/server.go:2007 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc001e8c300, 0x2003700, 0xc01ac2cee0, 0xc00a476600)
github.com/gorilla/mux@v1.7.3/mux.go:212 +0xe2
net/http.serverHandler.ServeHTTP(0xc0048f60e0, 0x2003700, 0xc01ac2cee0, 0xc00a476600)
net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc013ccf180, 0x20096c0, 0xc008464780)
net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
net/http/server.go:2927 +0x38e

QA Test Steps

Some regression testing around user statuses should be sufficient

Activity

Show:
Lindy Isherwood
August 26, 2020, 8:00 AM

Thanks ADS, tested on 5.27 release branch around user statuses and did not find any issues. Closing.

Lindy Isherwood
August 25, 2020, 6:37 PM

Tested user-statuses on esr.test 5.25.4-rc4 and did not find any issues.

Lindy Isherwood
August 13, 2020, 10:22 AM

Tested user-statuses on the PR and did not find any issues.

Done

Mana

2

Assignee

Agniva De Sarker

QA Assignee

Lindy Isherwood

Reporter

Agniva De Sarker

Epic Link

None

Mattermost Team

Server

Sprint

None

Labels

QA Testing Areas

Other (write in QA test steps)

GitHub Issue

None

Components

None

Severity

None