Coder Social home page Coder Social logo

Comments (12)

edwargix avatar edwargix commented on July 24, 2024 1

Hi, I am experiencing an issue that looks to be the same as what you're facing:

time="2021-12-31T20:10:05Z" level=fatal msg="error syncing: ProcessResponse panicked! since= panic=runtime error: slice bounds out of range [:160] with capacity 152\ngoroutine 1 [running]:\nruntime/debug.Stack()\n\t/usr/lib/go/src/runtime/debug/stack.go:24 +0x65\nmaunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse.func1()\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:133 +0x66\npanic({0x8ba520, 0xc000400690})\n\t/usr/lib/go/src/runtime/panic.go:1038 +0x215\nmaunium.net/go/mautrix/crypto/canonicaljson.RawJSONFromResult(...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:274\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject.func1({0x3, {0xc000356869, 0x17}, {0xc00035686a, 0x15}, 0x0, 0x89, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:113 +0x2d4\ngithub.com/tidwall/gjson.Result.ForEach({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/github.com/tidwall/[email protected]/gjson.go:293 +0x52c\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:110 +0x165\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:136 +0x5f3\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289\nmaunium.net/go/mautrix/crypto/canonicaljson.SortJSON({0xc000356360, 0xc000258f00, 0x113}, {0xc0003565a0, 0x0, 0x113})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:51 +0x23a\nmaunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSONAssumeValid({0xc000356120, 0x113, 0x120})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:42 +0x96\nmaunium.net/go/mautrix/crypto/olm.(*Utility).VerifySignatureJSON(0x50, {0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:146 +0x2c7\nmaunium.net/go/mautrix/crypto/olm.VerifySignatureJSON({0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:159 +0xe5\nmaunium.net/go/mautrix/crypto.(*OlmMachine).validateDevice(0x0, {0xc000400408, 0x2}, {0xc0004140f0, 0xa}, {{0xc0004003c0, 0x15}, {0xc0004140d0, 0xa}, {0xc0001ae880, ...}, ...}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:165 +0x21d\nmaunium.net/go/mautrix/crypto.(*OlmMachine).fetchKeys(0xc0000fc300, {0xc0003dc520, 0x1, 0x1}, {0x0, 0x0}, 0x1)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:75 +0xf2c\nmaunium.net/go/mautrix/crypto.(*OlmMachine).GetOrFetchDevice(0xc0000fc300, {0xc000437a10, 0x2b}, {0xc0003e03a0, 0xa})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/machine.go:343 +0x108\nmaunium.net/go/mautrix/crypto.(*OlmMachine).DecryptMegolmEvent(0xc0000fc300, 0xc000202780)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/decryptmegolm.go:58 +0x457\nmain.main.func3(0x878d60, 0xc000202780)\n\t/main.go:70 +0x54\nmaunium.net/go/mautrix.(*DefaultSyncer).notifyListeners(0xc0000667d0, 0xc000296510, 0xc000202780)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:203 +0xd7\nmaunium.net/go/mautrix.(*DefaultSyncer).processSyncEvent(0xc0000667d0, {0xc0000193b0, 0xc00018fcb0}, 0xc000202780, 0x22)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:193 +0x105\nmaunium.net/go/mautrix.(*DefaultSyncer).processSyncEvents(0xc000159ab8, {0xc0000193b0, 0x21}, {0xc00017e200, 0x32, 0xc00010e540}, 0xc000108d00)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:164 +0x4a\nmaunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse(0xc0000667d0, 0xc0000ce000, {0x0, 0x0})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:148 +0x293\nmaunium.net/go/mautrix.(*Client).SyncWithContext(0xc0000c82a0, {0x96c470, 0xc00001c038})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:284 +0x46f\nmaunium.net/go/mautrix.(*Client).Sync(...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:225\nmain.main()\n\t/main.go:114 +0x10f9\n"

Here's the log message with actual newlines and tabs:

time="2021-12-31T20:10:05Z" level=fatal msg="error syncing: ProcessResponse panicked! since= panic=runtime error: slice bounds out of range [:160] with capacity 152
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x65
maunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse.func1()
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:133 +0x66
panic({0x8ba520, 0xc000400690})
	/usr/lib/go/src/runtime/panic.go:1038 +0x215
maunium.net/go/mautrix/crypto/canonicaljson.RawJSONFromResult(...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:274
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject.func1({0x3, {0xc000356869, 0x17}, {0xc00035686a, 0x15}, 0x0, 0x89, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:113 +0x2d4
github.com/tidwall/gjson.Result.ForEach({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/github.com/tidwall/[email protected]/gjson.go:293 +0x52c
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:110 +0x165
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:136 +0x5f3
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289
maunium.net/go/mautrix/crypto/canonicaljson.SortJSON({0xc000356360, 0xc000258f00, 0x113}, {0xc0003565a0, 0x0, 0x113})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:51 +0x23a
maunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSONAssumeValid({0xc000356120, 0x113, 0x120})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:42 +0x96
maunium.net/go/mautrix/crypto/olm.(*Utility).VerifySignatureJSON(0x50, {0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:146 +0x2c7
maunium.net/go/mautrix/crypto/olm.VerifySignatureJSON({0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:159 +0xe5
maunium.net/go/mautrix/crypto.(*OlmMachine).validateDevice(0x0, {0xc000400408, 0x2}, {0xc0004140f0, 0xa}, {{0xc0004003c0, 0x15}, {0xc0004140d0, 0xa}, {0xc0001ae880, ...}, ...}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:165 +0x21d
maunium.net/go/mautrix/crypto.(*OlmMachine).fetchKeys(0xc0000fc300, {0xc0003dc520, 0x1, 0x1}, {0x0, 0x0}, 0x1)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:75 +0xf2c
maunium.net/go/mautrix/crypto.(*OlmMachine).GetOrFetchDevice(0xc0000fc300, {0xc000437a10, 0x2b}, {0xc0003e03a0, 0xa})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/machine.go:343 +0x108
maunium.net/go/mautrix/crypto.(*OlmMachine).DecryptMegolmEvent(0xc0000fc300, 0xc000202780)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/decryptmegolm.go:58 +0x457
main.main.func3(0x878d60, 0xc000202780)
	/main.go:70 +0x54
maunium.net/go/mautrix.(*DefaultSyncer).notifyListeners(0xc0000667d0, 0xc000296510, 0xc000202780)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:203 +0xd7
maunium.net/go/mautrix.(*DefaultSyncer).processSyncEvent(0xc0000667d0, {0xc0000193b0, 0xc00018fcb0}, 0xc000202780, 0x22)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:193 +0x105
maunium.net/go/mautrix.(*DefaultSyncer).processSyncEvents(0xc000159ab8, {0xc0000193b0, 0x21}, {0xc00017e200, 0x32, 0xc00010e540}, 0xc000108d00)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:164 +0x4a
maunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse(0xc0000667d0, 0xc0000ce000, {0x0, 0x0})
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:148 +0x293
maunium.net/go/mautrix.(*Client).SyncWithContext(0xc0000c82a0, {0x96c470, 0xc00001c038})
	/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:284 +0x46f
maunium.net/go/mautrix.(*Client).Sync(...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:225
main.main()
	/main.go:114 +0x10f9
"

I've found that the following patch fixes the issue, though at the expense of removing an optimization for gjson:

From f4965a653a70e66786665431442c607b54de73e4 Mon Sep 17 00:00:00 2001
From: David Florness <[email protected]>
Date: Fri, 31 Dec 2021 14:19:28 -0600
Subject: [PATCH] Don't use gjson slice optimization

This is a workaround for https://github.com/mautrix/go/issues/52
---
 crypto/canonicaljson/json.go | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/crypto/canonicaljson/json.go b/crypto/canonicaljson/json.go
index 8c12176..231d798 100644
--- a/crypto/canonicaljson/json.go
+++ b/crypto/canonicaljson/json.go
@@ -266,15 +266,7 @@ func readHexDigits(input []byte) uint32 {
 // RawJSONFromResult extracts the raw JSON bytes pointed to by result.
 // input must be the json bytes that were used to generate result
 func RawJSONFromResult(result gjson.Result, input []byte) (RawJSON []byte) {
-	// This is lifted from gjson README. Basically, result.Raw is a copy of
-	// the bytes we want, but its more efficient to take a slice.
-	// If Index is 0 then for some reason we can't extract it from the original
-	// JSON bytes.
-	if result.Index > 0 {
-		RawJSON = input[result.Index : result.Index+len(result.Raw)]
-	} else {
-		RawJSON = []byte(result.Raw)
-	}
+	RawJSON = []byte(result.Raw)
 
 	return
 }
-- 
2.32.0

I unfortunately haven't yet been able to find a proper fix, but hopefully this can be used as a workaround in the short term?

All the best.

from go.

tulir avatar tulir commented on July 24, 2024 1

Looks like there's some sort of regression in gjson. I noticed while trying to update the version used in mautrix-go and reverted it back to the old version now.

I'm not sure why you were using the wrong version though.

from go.

rakshazi avatar rakshazi commented on July 24, 2024 1

In my case it was go get -u - that flag updates minor and patch versions of dependencies (including indirect/transitive) automatically

from go.

edwargix avatar edwargix commented on July 24, 2024 1

Fix here: #62

from go.

edwargix avatar edwargix commented on July 24, 2024

Hi, I am experiencing an issue that looks to be the same as what you're facing:

time="2021-12-31T20:10:05Z" level=fatal msg="error syncing: ProcessResponse panicked! since= panic=runtime error: slice bounds out of range [:160] with capacity 152\ngoroutine 1 [running]:\nruntime/debug.Stack()\n\t/usr/lib/go/src/runtime/debug/stack.go:24 +0x65\nmaunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse.func1()\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:133 +0x66\npanic({0x8ba520, 0xc000400690})\n\t/usr/lib/go/src/runtime/panic.go:1038 +0x215\nmaunium.net/go/mautrix/crypto/canonicaljson.RawJSONFromResult(...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:274\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject.func1({0x3, {0xc000356869, 0x17}, {0xc00035686a, 0x15}, 0x0, 0x89, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:113 +0x2d4\ngithub.com/tidwall/gjson.Result.ForEach({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/github.com/tidwall/[email protected]/gjson.go:293 +0x52c\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:110 +0x165\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:136 +0x5f3\nmaunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289\nmaunium.net/go/mautrix/crypto/canonicaljson.SortJSON({0xc000356360, 0xc000258f00, 0x113}, {0xc0003565a0, 0x0, 0x113})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:51 +0x23a\nmaunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSONAssumeValid({0xc000356120, 0x113, 0x120})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:42 +0x96\nmaunium.net/go/mautrix/crypto/olm.(*Utility).VerifySignatureJSON(0x50, {0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:146 +0x2c7\nmaunium.net/go/mautrix/crypto/olm.VerifySignatureJSON({0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:159 +0xe5\nmaunium.net/go/mautrix/crypto.(*OlmMachine).validateDevice(0x0, {0xc000400408, 0x2}, {0xc0004140f0, 0xa}, {{0xc0004003c0, 0x15}, {0xc0004140d0, 0xa}, {0xc0001ae880, ...}, ...}, ...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:165 +0x21d\nmaunium.net/go/mautrix/crypto.(*OlmMachine).fetchKeys(0xc0000fc300, {0xc0003dc520, 0x1, 0x1}, {0x0, 0x0}, 0x1)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:75 +0xf2c\nmaunium.net/go/mautrix/crypto.(*OlmMachine).GetOrFetchDevice(0xc0000fc300, {0xc000437a10, 0x2b}, {0xc0003e03a0, 0xa})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/machine.go:343 +0x108\nmaunium.net/go/mautrix/crypto.(*OlmMachine).DecryptMegolmEvent(0xc0000fc300, 0xc000202780)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/decryptmegolm.go:58 +0x457\nmain.main.func3(0x878d60, 0xc000202780)\n\t/main.go:70 +0x54\nmaunium.net/go/mautrix.(*DefaultSyncer).notifyListeners(0xc0000667d0, 0xc000296510, 0xc000202780)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:203 +0xd7\nmaunium.net/go/mautrix.(*DefaultSyncer).processSyncEvent(0xc0000667d0, {0xc0000193b0, 0xc00018fcb0}, 0xc000202780, 0x22)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:193 +0x105\nmaunium.net/go/mautrix.(*DefaultSyncer).processSyncEvents(0xc000159ab8, {0xc0000193b0, 0x21}, {0xc00017e200, 0x32, 0xc00010e540}, 0xc000108d00)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:164 +0x4a\nmaunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse(0xc0000667d0, 0xc0000ce000, {0x0, 0x0})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:148 +0x293\nmaunium.net/go/mautrix.(*Client).SyncWithContext(0xc0000c82a0, {0x96c470, 0xc00001c038})\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:284 +0x46f\nmaunium.net/go/mautrix.(*Client).Sync(...)\n\t/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:225\nmain.main()\n\t/main.go:114 +0x10f9\n"

Here's the log message with actual newlines and tabs:

time="2021-12-31T20:10:05Z" level=fatal msg="error syncing: ProcessResponse panicked! since= panic=runtime error: slice bounds out of range [:160] with capacity 152
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x65
maunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse.func1()
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:133 +0x66
panic({0x8ba520, 0xc000400690})
	/usr/lib/go/src/runtime/panic.go:1038 +0x215
maunium.net/go/mautrix/crypto/canonicaljson.RawJSONFromResult(...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:274
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject.func1({0x3, {0xc000356869, 0x17}, {0xc00035686a, 0x15}, 0x0, 0x89, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:113 +0x2d4
github.com/tidwall/gjson.Result.ForEach({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/github.com/tidwall/[email protected]/gjson.go:293 +0x52c
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:110 +0x165
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc000356868, 0x8a}, {0x0, 0x0}, 0x0, 0x88, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONObject({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:136 +0x5f3
maunium.net/go/mautrix/crypto/canonicaljson.sortJSONValue({0x5, {0xc0003567e0, 0x113}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:62 +0x289
maunium.net/go/mautrix/crypto/canonicaljson.SortJSON({0xc000356360, 0xc000258f00, 0x113}, {0xc0003565a0, 0x0, 0x113})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:51 +0x23a
maunium.net/go/mautrix/crypto/canonicaljson.CanonicalJSONAssumeValid({0xc000356120, 0x113, 0x120})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/canonicaljson/json.go:42 +0x96
maunium.net/go/mautrix/crypto/olm.(*Utility).VerifySignatureJSON(0x50, {0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:146 +0x2c7
maunium.net/go/mautrix/crypto/olm.VerifySignatureJSON({0x8bc0e0, 0xc0003920f0}, {0xc000400408, 0x15}, {0xc0004140f0, 0xa}, {0xc000424210, 0x2b})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/olm/utility.go:159 +0xe5
maunium.net/go/mautrix/crypto.(*OlmMachine).validateDevice(0x0, {0xc000400408, 0x2}, {0xc0004140f0, 0xa}, {{0xc0004003c0, 0x15}, {0xc0004140d0, 0xa}, {0xc0001ae880, ...}, ...}, ...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:165 +0x21d
maunium.net/go/mautrix/crypto.(*OlmMachine).fetchKeys(0xc0000fc300, {0xc0003dc520, 0x1, 0x1}, {0x0, 0x0}, 0x1)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/devicelist.go:75 +0xf2c
maunium.net/go/mautrix/crypto.(*OlmMachine).GetOrFetchDevice(0xc0000fc300, {0xc000437a10, 0x2b}, {0xc0003e03a0, 0xa})
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/machine.go:343 +0x108
maunium.net/go/mautrix/crypto.(*OlmMachine).DecryptMegolmEvent(0xc0000fc300, 0xc000202780)
	/root/go/pkg/mod/maunium.net/go/[email protected]/crypto/decryptmegolm.go:58 +0x457
main.main.func3(0x878d60, 0xc000202780)
	/main.go:70 +0x54
maunium.net/go/mautrix.(*DefaultSyncer).notifyListeners(0xc0000667d0, 0xc000296510, 0xc000202780)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:203 +0xd7
maunium.net/go/mautrix.(*DefaultSyncer).processSyncEvent(0xc0000667d0, {0xc0000193b0, 0xc00018fcb0}, 0xc000202780, 0x22)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:193 +0x105
maunium.net/go/mautrix.(*DefaultSyncer).processSyncEvents(0xc000159ab8, {0xc0000193b0, 0x21}, {0xc00017e200, 0x32, 0xc00010e540}, 0xc000108d00)
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:164 +0x4a
maunium.net/go/mautrix.(*DefaultSyncer).ProcessResponse(0xc0000667d0, 0xc0000ce000, {0x0, 0x0})
	/root/go/pkg/mod/maunium.net/go/[email protected]/sync.go:148 +0x293
maunium.net/go/mautrix.(*Client).SyncWithContext(0xc0000c82a0, {0x96c470, 0xc00001c038})
	/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:284 +0x46f
maunium.net/go/mautrix.(*Client).Sync(...)
	/root/go/pkg/mod/maunium.net/go/[email protected]/client.go:225
main.main()
	/main.go:114 +0x10f9
"

Also, although the output here was for mautrix-go 0.10.6, the issue is still happening in version 0.10.8 (the latest release). Unfortunately I didn't think to keep the logs for when I last hit the problem on mautrix-go 0.10.8.

from go.

rakshazi avatar rakshazi commented on July 24, 2024

I can provide logs for 0.10.8 if anybody need them, but they are pretty same

from go.

rakshazi avatar rakshazi commented on July 24, 2024

Sorry for delay,

the issue fixed with new mautrix-go release, thank you!

from go.

edwargix avatar edwargix commented on July 24, 2024

Looks like there's some sort of regression in gjson. I noticed while trying to update the version used in mautrix-go and reverted it back to the old version now.

I'm not sure why you were using the wrong version though.

Yeah this shouldn't have applied to us right?

I'm not sure how v0.10.9 fixes the issue since there's no change in the gjson version from v0.10.8: v0.10.8...v0.10.9

from go.

rakshazi avatar rakshazi commented on July 24, 2024

The updated gjson version was my issue

from go.

tulir avatar tulir commented on July 24, 2024

All mautrix-go releases have the correct gjson version, but both of your stacktraces had the wrong version. Using the correct gjson version (v1.10.2) will fix it

from go.

edwargix avatar edwargix commented on July 24, 2024

All mautrix-go releases have the correct gjson version, but both of your stacktraces had the wrong version. Using the correct gjson version (v1.10.2) will fix it

Oh I see; I didn't even notice the v1.12.1 in my stacktrace! Like you, I'm also unsure why it was using that version, especially since my program doesn't use gjson directly (only through mautrix-go). There must be something go-get does with transitive dependency versioning that I don't know about.

Regardless, thanks for the help!

from go.

edwargix avatar edwargix commented on July 24, 2024

I submitted a bug report in gjson for this issue: tidwall/gjson#263

from go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.