Use fork of mautrix-go with bugfix
We're occasionally hitting the following error:
panic: runtime error: slice bounds out of range [:208] with capacity 90 [recovered]
panic: runtime error: slice bounds out of range [:208] with capacity 90 [recovered]
panic: (*logrus.Entry) (0xbef2e0,0xc0000d2070)
goroutine 1 [running]:
github.com/sirupsen/logrus.(*Entry).log(0xc0001b62a0, 0x0, 0xc000464000, 0xf8f)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:259 +0x2e2
github.com/sirupsen/logrus.(*Entry).Log(0xc0001b62a0, 0x0, 0xc0004383f0, 0x1, 0x1)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:293 +0x86
github.com/sirupsen/logrus.(*Entry).Logf(0xc0001b62a0, 0xc000000000, 0xc0d38a, 0x1d, 0xc0004384a8, 0x2, 0x2)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:338 +0xe2
github.com/sirupsen/logrus.(*Logger).Logf(0xc0000d2e00, 0x0, 0xc0d38a, 0x1d, 0xc0004384a8, 0x2, 0x2)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/logger.go:151 +0x94
github.com/sirupsen/logrus.(*Logger).Panicf(...)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/logger.go:192
github.com/sirupsen/logrus.Panicf(...)
/home/matrix/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/exported.go:219
tallyard.xyz/ui.RoomTUI.func1(0xc000308130)
/home/matrix/src/ui/tui.go:189 +0xe5
panic(0xba8da0, 0xc00033e980)
/usr/lib/go/src/runtime/panic.go:679 +0x1b2
github.com/rivo/tview.(*Application).Run.func1(0xc000358000)
/home/matrix/go/pkg/mod/github.com/rivo/tview@v0.0.0-20211202162923-2a6de950f73b/application.go:243 +0x82
panic(0xba8da0, 0xc00033e980)
/usr/lib/go/src/runtime/panic.go:679 +0x1b2
maunium.net/go/mautrix/crypto/canonicaljson.RawJSONFromResult(...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:274
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject.func1(0x3, 0xc0003652c7, 0x9, 0xc0003652c8, 0x7, 0x0, 0xc7, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:113 +0x2b5
github.com/tidwall/gjson.Result.ForEach(0x5, 0xc0003652c6, 0x55, 0x0, 0x0, 0x0, 0xc6, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/github.com/tidwall/gjson@v1.12.1/gjson.go:293 +0x33d
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject(0x5, 0xc0003652c6, 0x55, 0x0, 0x0, 0x0, 0xc6, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:110 +0xe4
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue(0x5, 0xc0003652c6, 0x55, 0x0, 0x0, 0x0, 0xc6, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:62 +0x23b
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject(0x5, 0xc000365200, 0x11c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:136 +0x39d
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue(0x5, 0xc000365200, 0x11c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:62 +0x23b
maunium.net/go/mautrix/crypto/canonicaljson.SortJSON(0xc000364fc0, 0x11c, 0x11c, 0xc0003650e0, 0x0, 0x11c, 0xc000364fc0, 0x11c, 0x11c)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:51 +0x1b1
maunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSONAssumeValid(0xc000364fc0, 0x11c, 0x11c, 0x120, 0xc000364ea0, 0x11c)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:42 +0xe0
maunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSON(0xc000364d80, 0x11c, 0x120, 0x11c, 0x120, 0x0, 0x0, 0x382a611eb390c)
/home/matrix/go/pkg/mod/maunium.net/go/mautrix@v0.10.8/crypto/canonicaljson/json.go:35 +0x8e
tallyard.xyz/election.CalculateCommitment(0xc0004396e8, 0x1, 0x1, 0x20, 0x20, 0x20, 0x20)
/home/matrix/src/election/utils.go:42 +0x153
tallyard.xyz/election.(*Election).JoinElection(0xc0000a6f00, 0xc0000e4460, 0xc000064140, 0x0, 0x0)
/home/matrix/src/election/voter.go:101 +0x24d
tallyard.xyz/ui.RoomTUI.func4(0x0, 0xc05072, 0xf, 0xc10084, 0x21, 0xc000000000)
/home/matrix/src/ui/tui.go:268 +0x32f
github.com/rivo/tview.(*List).InputHandler.func1(0xc00027a180, 0xc0003081b0)
/home/matrix/go/pkg/mod/github.com/rivo/tview@v0.0.0-20211202162923-2a6de950f73b/list.go:591 +0x278
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc00027a180, 0xc0003081b0)
/home/matrix/go/pkg/mod/github.com/rivo/tview@v0.0.0-20211202162923-2a6de950f73b/box.go:167 +0x5d
github.com/rivo/tview.(*Application).Run(0xc000358000, 0x0, 0x0)
/home/matrix/go/pkg/mod/github.com/rivo/tview@v0.0.0-20211202162923-2a6de950f73b/application.go:335 +0x7db
tallyard.xyz/ui.(*tallyardApplication).Run(...)
/home/matrix/src/ui/tui.go:594
tallyard.xyz/ui.RoomTUI(0xc0002fe060, 0xc0000e4460, 0xc00025c010, 0xc0002fe000, 0xd02740, 0xc0000a0820, 0xc00025c010, 0x0, 0x0)
/home/matrix/src/ui/tui.go:285 +0x479
main.main()
/home/matrix/src/cmd/tallyard/main.go:110 +0x7fb
My fork of mautrix-go at git.hnitbjorg.xyz has a patch that forgoes a gjson
optimization to prevent this issue.
See https://git.hnitbjorg.xyz/~edwargix/mautrix-go/commit/f4965a653a70 and
https://github.com/mautrix/go/issues/52 for further details.