diff --git a/federationapi/federationapi_test.go b/federationapi/federationapi_test.go index 817ea5aab..8884e34c6 100644 --- a/federationapi/federationapi_test.go +++ b/federationapi/federationapi_test.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "strings" + "sync" "testing" "time" @@ -22,7 +23,6 @@ import ( "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/nats-io/nats.go" - "github.com/sasha-s/go-deadlock" ) type fedRoomserverAPI struct { @@ -49,7 +49,7 @@ func (f *fedRoomserverAPI) QueryRoomsForUser(ctx context.Context, req *rsapi.Que // TODO: This struct isn't generic, only works for TestFederationAPIJoinThenKeyUpdate type fedClient struct { - fedClientMutex deadlock.Mutex + fedClientMutex sync.Mutex api.FederationClient allowJoins []*test.Room keys map[gomatrixserverlib.ServerName]struct { diff --git a/go.mod b/go.mod index 5bda514ce..377a156fe 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,6 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.12.2 - github.com/sasha-s/go-deadlock v0.3.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.1 github.com/tidwall/gjson v1.14.1 @@ -95,7 +94,6 @@ require ( github.com/onsi/gomega v1.17.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect diff --git a/go.sum b/go.sum index 1dcba2ff4..10b1638a5 100644 --- a/go.sum +++ b/go.sum @@ -424,8 +424,6 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -466,8 +464,6 @@ github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBO github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= diff --git a/internal/sqlutil/migrate.go b/internal/sqlutil/migrate.go index 06edb163d..cb0aed7d3 100644 --- a/internal/sqlutil/migrate.go +++ b/internal/sqlutil/migrate.go @@ -22,7 +22,6 @@ import ( "time" "github.com/matrix-org/dendrite/internal" - "github.com/sasha-s/go-deadlock" "github.com/sirupsen/logrus" ) @@ -51,7 +50,7 @@ type Migration struct { // Migrator type Migrator struct { - gooseMutex deadlock.Mutex + gooseMutex sync.Mutex db *sql.DB migrations []Migration knownMigrations map[string]struct{} diff --git a/keyserver/storage/storage_test.go b/keyserver/storage/storage_test.go index 725d40b4b..231a4647c 100644 --- a/keyserver/storage/storage_test.go +++ b/keyserver/storage/storage_test.go @@ -3,6 +3,7 @@ package storage_test import ( "context" "reflect" + "sync" "testing" "github.com/matrix-org/dendrite/keyserver/api" @@ -10,7 +11,6 @@ import ( "github.com/matrix-org/dendrite/keyserver/types" "github.com/matrix-org/dendrite/test" "github.com/matrix-org/dendrite/test/testrig" - "github.com/sasha-s/go-deadlock" ) var ctx = context.Background() @@ -104,7 +104,7 @@ func TestKeyChangesUpperLimit(t *testing.T) { }) } -var dbLock deadlock.Mutex +var dbLock sync.Mutex var deviceArray = []string{"AAA", "another_device"} // The purpose of this test is to make sure that the storage layer is generating sequential stream IDs per user, diff --git a/setup/jetstream/nats.go b/setup/jetstream/nats.go index 0c03fb6b8..5359b4581 100644 --- a/setup/jetstream/nats.go +++ b/setup/jetstream/nats.go @@ -4,12 +4,12 @@ import ( "fmt" "reflect" "strings" + "sync" "time" "github.com/getsentry/sentry-go" "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/setup/process" - "github.com/sasha-s/go-deadlock" "github.com/sirupsen/logrus" natsserver "github.com/nats-io/nats-server/v2/server" @@ -20,7 +20,7 @@ type NATSInstance struct { *natsserver.Server } -var natsLock deadlock.Mutex +var natsLock sync.Mutex func DeleteAllStreams(js natsclient.JetStreamContext, cfg *config.JetStream) { for _, stream := range streams { // streams are defined in streams.go diff --git a/syncapi/sync/requestpool_test.go b/syncapi/sync/requestpool_test.go index a60d11fa4..5142f5dd3 100644 --- a/syncapi/sync/requestpool_test.go +++ b/syncapi/sync/requestpool_test.go @@ -9,11 +9,10 @@ import ( "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/syncapi/types" "github.com/matrix-org/gomatrixserverlib" - "github.com/sasha-s/go-deadlock" ) type dummyPublisher struct { - lock deadlock.Mutex + lock sync.Mutex count int }