From 29fa8cc1d13510483598a4dcb87515180ffec92a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 12 Sep 2024 16:05:03 +0300 Subject: [PATCH] all: add deadlock detection temporarily --- go.mod | 3 ++- go.sum | 6 ++++-- pkg/connector/client.go | 3 ++- pkg/connector/dbmeta.go | 3 ++- pkg/libgm/client.go | 3 ++- pkg/libgm/longpoll.go | 3 ++- pkg/libgm/pair_google.go | 3 ++- pkg/libgm/session_handler.go | 3 ++- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 2cdde48..0f3d9da 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,14 @@ require ( github.com/gabriel-vasile/mimetype v1.4.5 github.com/google/uuid v1.6.0 github.com/rs/zerolog v1.33.0 + github.com/sasha-s/go-deadlock v0.3.5 github.com/stretchr/testify v1.9.0 go.mau.fi/util v0.7.1-0.20240904173517-ca3b3fe376c2 golang.org/x/crypto v0.26.0 golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 - maunium.net/go/mautrix v0.20.1-0.20240905211528-059d9a36e5cf + maunium.net/go/mautrix v0.20.1-0.20240912130037-80d5daa6fff7 ) require ( diff --git a/go.sum b/go.sum index b4e4797..099ec49 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,8 @@ github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= @@ -93,5 +95,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M= maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA= -maunium.net/go/mautrix v0.20.1-0.20240905211528-059d9a36e5cf h1:73OVwmttwOdmIJ+uAmbZg30z2QwFgspbVqGWG7874Ag= -maunium.net/go/mautrix v0.20.1-0.20240905211528-059d9a36e5cf/go.mod h1:l6nYvD5/FMSrAZ/IP1AqJV0b47SRl/0uQNRiy4CcSVk= +maunium.net/go/mautrix v0.20.1-0.20240912130037-80d5daa6fff7 h1:HgxXzqwi+ekWXyHhAwUdTFStvX4FFbEszJtZlI7PmLU= +maunium.net/go/mautrix v0.20.1-0.20240912130037-80d5daa6fff7/go.mod h1:3TU1g6a2zqvBOoIc4AUhDvoabvABUQ3PMpRIX6YPi88= diff --git a/pkg/connector/client.go b/pkg/connector/client.go index e28a267..c5daecc 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -19,10 +19,11 @@ package connector import ( "context" "errors" - "sync" "sync/atomic" "time" + sync "github.com/sasha-s/go-deadlock" + "github.com/rs/zerolog" "go.mau.fi/util/exsync" "maunium.net/go/mautrix/bridge/status" diff --git a/pkg/connector/dbmeta.go b/pkg/connector/dbmeta.go index 8530681..acd8175 100644 --- a/pkg/connector/dbmeta.go +++ b/pkg/connector/dbmeta.go @@ -20,7 +20,8 @@ import ( "encoding/json" "fmt" "slices" - "sync" + + sync "github.com/sasha-s/go-deadlock" "go.mau.fi/util/jsontime" "maunium.net/go/mautrix/bridgev2/database" diff --git a/pkg/libgm/client.go b/pkg/libgm/client.go index 6903964..ff5119d 100644 --- a/pkg/libgm/client.go +++ b/pkg/libgm/client.go @@ -9,10 +9,11 @@ import ( "net" "net/http" "net/url" - "sync" "sync/atomic" "time" + sync "github.com/sasha-s/go-deadlock" + "github.com/google/uuid" "github.com/rs/zerolog" diff --git a/pkg/libgm/longpoll.go b/pkg/libgm/longpoll.go index c0cf67b..c58d208 100644 --- a/pkg/libgm/longpoll.go +++ b/pkg/libgm/longpoll.go @@ -10,10 +10,11 @@ import ( "fmt" "io" "net/http" - "sync" "sync/atomic" "time" + sync "github.com/sasha-s/go-deadlock" + "github.com/google/uuid" "github.com/rs/zerolog" "go.mau.fi/util/pblite" diff --git a/pkg/libgm/pair_google.go b/pkg/libgm/pair_google.go index ffa4f99..1ae9aa1 100644 --- a/pkg/libgm/pair_google.go +++ b/pkg/libgm/pair_google.go @@ -32,9 +32,10 @@ import ( "slices" "strconv" "strings" - "sync" "time" + sync "github.com/sasha-s/go-deadlock" + "github.com/google/uuid" "github.com/rs/zerolog" "go.mau.fi/util/exslices" diff --git a/pkg/libgm/session_handler.go b/pkg/libgm/session_handler.go index 0f26e13..cfb737c 100644 --- a/pkg/libgm/session_handler.go +++ b/pkg/libgm/session_handler.go @@ -3,9 +3,10 @@ package libgm import ( "encoding/base64" "fmt" - "sync" "time" + sync "github.com/sasha-s/go-deadlock" + "github.com/google/uuid" "github.com/rs/zerolog" "golang.org/x/exp/slices"