From 5547bf8ca67af325df6560ab13e54d04c39c629b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 30 Apr 2024 23:12:52 +0000
Subject: [PATCH 1/2] Bump golang.org/x/net from 0.21.0 to 0.23.0 (#3365)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.21.0 to
0.23.0.
Commits
c48da13
http2: fix TestServerContinuationFlood flakes
762b58d
http2: fix tipos in comment
ba87210
http2: close connections when receiving too many headers
ebc8168
all: fix some typos
3678185
http2: make TestCanonicalHeaderCacheGrowth faster
448c44f
http2: remove clientTester
c7877ac
http2: convert the remaining clientTester tests to testClientConn
d8870b0
http2: use synthetic time in TestIdleConnTimeout
d73acff
http2: only set up deadline when Server.IdleTimeout is positive
89f602b
http2: validate client/outgoing trailers
- Additional commits viewable in compare
view
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/matrix-org/dendrite/network/alerts).
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 0dce89222..5c8155281 100644
--- a/go.mod
+++ b/go.mod
@@ -124,7 +124,7 @@ require (
github.com/tidwall/pretty v1.2.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/mod v0.14.0 // indirect
- golang.org/x/net v0.21.0 // indirect
+ golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
diff --git a/go.sum b/go.sum
index 1aea553f4..2ffa2c873 100644
--- a/go.sum
+++ b/go.sum
@@ -385,8 +385,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
-golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
-golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
+golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
+golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
From 46902e5766cc8efcc4f1abb38789f8179893c17d Mon Sep 17 00:00:00 2001
From: 0x1a8510f2
Date: Wed, 1 May 2024 01:38:36 +0100
Subject: [PATCH 2/2] Take advantage of changes in recent Go versions (#3361)
Given that #2714 wasn't merged but we are now at a minimum supported Go
version of 1.20 (soon to be 1.21), I wanted to carry over some of the
changes. Namely:
- Fix the log typo
- Simplify build constraints for unix
- Use stdlib atomic package
### Pull Request Checklist
* [x] I have added Go unit tests or [Complement integration
tests](https://github.com/matrix-org/complement) for this PR _or_ I have
justified why this PR doesn't need tests
* [x] Pull request includes a [sign off below using a legally
identifiable
name](https://matrix-org.github.io/dendrite/development/contributing#sign-off)
_or_ I have already signed off privately
Signed-off-by: `0x1a8510f2 `
---------
Co-authored-by: devonh
---
clientapi/routing/routing.go | 2 +-
cmd/dendrite-demo-pinecone/relay/retriever.go | 4 ++--
federationapi/queue/destinationqueue.go | 2 +-
federationapi/queue/queue_test.go | 6 +++---
federationapi/statistics/statistics.go | 6 +++---
internal/sqlutil/writer_exclusive.go | 3 +--
internal/transactionrequest_test.go | 14 +++++++-------
setup/base/base.go | 2 +-
setup/base/sanity_other.go | 4 ++--
setup/base/sanity_unix.go | 4 ++--
10 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index c96c6538c..60dad5433 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -255,7 +255,7 @@ func Setup(
logrus.Info("Enabling server notices at /_synapse/admin/v1/send_server_notice")
serverNotificationSender, err := getSenderDevice(context.Background(), rsAPI, userAPI, cfg)
if err != nil {
- logrus.WithError(err).Fatal("unable to get account for sending sending server notices")
+ logrus.WithError(err).Fatal("unable to get account for sending server notices")
}
synapseAdminRouter.Handle("/admin/v1/send_server_notice/{txnID}",
diff --git a/cmd/dendrite-demo-pinecone/relay/retriever.go b/cmd/dendrite-demo-pinecone/relay/retriever.go
index 3c76ad600..9c918fb67 100644
--- a/cmd/dendrite-demo-pinecone/relay/retriever.go
+++ b/cmd/dendrite-demo-pinecone/relay/retriever.go
@@ -17,13 +17,13 @@ package relay
import (
"context"
"sync"
+ "sync/atomic"
"time"
federationAPI "github.com/matrix-org/dendrite/federationapi/api"
relayServerAPI "github.com/matrix-org/dendrite/relayapi/api"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/sirupsen/logrus"
- "go.uber.org/atomic"
)
const (
@@ -54,7 +54,7 @@ func NewRelayServerRetriever(
federationAPI: federationAPI,
relayAPI: relayAPI,
relayServersQueried: make(map[spec.ServerName]bool),
- running: *atomic.NewBool(false),
+ running: atomic.Bool{},
quit: quit,
}
}
diff --git a/federationapi/queue/destinationqueue.go b/federationapi/queue/destinationqueue.go
index 87a6fe559..be43aaf1c 100644
--- a/federationapi/queue/destinationqueue.go
+++ b/federationapi/queue/destinationqueue.go
@@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"sync"
+ "sync/atomic"
"time"
"github.com/matrix-org/gomatrix"
@@ -26,7 +27,6 @@ import (
"github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/sirupsen/logrus"
- "go.uber.org/atomic"
"github.com/matrix-org/dendrite/federationapi/statistics"
"github.com/matrix-org/dendrite/federationapi/storage"
diff --git a/federationapi/queue/queue_test.go b/federationapi/queue/queue_test.go
index 6da863427..7d21a3bb3 100644
--- a/federationapi/queue/queue_test.go
+++ b/federationapi/queue/queue_test.go
@@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "sync/atomic"
"testing"
"time"
@@ -26,7 +27,6 @@ import (
"github.com/matrix-org/dendrite/test/testrig"
"github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
- "go.uber.org/atomic"
"gotest.tools/v3/poll"
"github.com/matrix-org/gomatrixserverlib"
@@ -113,8 +113,8 @@ func testSetup(failuresUntilBlacklist uint32, failuresUntilAssumedOffline uint32
fc := &stubFederationClient{
shouldTxSucceed: shouldTxSucceed,
shouldTxRelaySucceed: shouldTxRelaySucceed,
- txCount: *atomic.NewUint32(0),
- txRelayCount: *atomic.NewUint32(0),
+ txCount: atomic.Uint32{},
+ txRelayCount: atomic.Uint32{},
}
stats := statistics.NewStatistics(db, failuresUntilBlacklist, failuresUntilAssumedOffline, false)
diff --git a/federationapi/statistics/statistics.go b/federationapi/statistics/statistics.go
index e133fc9c9..750c57fd7 100644
--- a/federationapi/statistics/statistics.go
+++ b/federationapi/statistics/statistics.go
@@ -5,10 +5,10 @@ import (
"math"
"math/rand"
"sync"
+ "sync/atomic"
"time"
"github.com/sirupsen/logrus"
- "go.uber.org/atomic"
"github.com/matrix-org/dendrite/federationapi/storage"
"github.com/matrix-org/gomatrixserverlib/spec"
@@ -169,7 +169,7 @@ func (s *ServerStatistics) Success(method SendMethod) {
// NOTE : Sending to the final destination vs. a relay server has
// slightly different semantics.
if method == SendDirect {
- s.successCounter.Inc()
+ s.successCounter.Add(1)
if s.blacklisted.Load() && s.statistics.DB != nil {
if err := s.statistics.DB.RemoveServerFromBlacklist(s.serverName); err != nil {
logrus.WithError(err).Errorf("Failed to remove %q from blacklist", s.serverName)
@@ -195,7 +195,7 @@ func (s *ServerStatistics) Failure() (time.Time, bool) {
// start a goroutine which will wait out the backoff and
// unset the backoffStarted flag when done.
if s.backoffStarted.CompareAndSwap(false, true) {
- backoffCount := s.backoffCount.Inc()
+ backoffCount := s.backoffCount.Add(1)
if backoffCount >= s.statistics.FailuresUntilAssumedOffline {
s.assumedOffline.CompareAndSwap(false, true)
diff --git a/internal/sqlutil/writer_exclusive.go b/internal/sqlutil/writer_exclusive.go
index c6a271c1c..69eb8609c 100644
--- a/internal/sqlutil/writer_exclusive.go
+++ b/internal/sqlutil/writer_exclusive.go
@@ -3,8 +3,7 @@ package sqlutil
import (
"database/sql"
"errors"
-
- "go.uber.org/atomic"
+ "sync/atomic"
)
// ExclusiveWriter implements sqlutil.Writer.
diff --git a/internal/transactionrequest_test.go b/internal/transactionrequest_test.go
index ffc1cd89a..8dd100d11 100644
--- a/internal/transactionrequest_test.go
+++ b/internal/transactionrequest_test.go
@@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"strconv"
+ "sync/atomic"
"testing"
"time"
@@ -26,7 +27,6 @@ import (
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/nats-io/nats.go"
"github.com/stretchr/testify/assert"
- "go.uber.org/atomic"
"gotest.tools/v3/poll"
"github.com/matrix-org/dendrite/federationapi/producers"
@@ -228,7 +228,7 @@ func TestProcessTransactionRequestEDUTyping(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
room := msg.Header.Get(jetstream.RoomID)
@@ -294,7 +294,7 @@ func TestProcessTransactionRequestEDUToDevice(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
@@ -371,7 +371,7 @@ func TestProcessTransactionRequestEDUDeviceListUpdate(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
@@ -468,7 +468,7 @@ func TestProcessTransactionRequestEDUReceipt(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
@@ -512,7 +512,7 @@ func TestProcessTransactionRequestEDUSigningKeyUpdate(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
@@ -569,7 +569,7 @@ func TestProcessTransactionRequestEDUPresence(t *testing.T) {
ctx := process.NewProcessContext()
defer ctx.ShutdownDendrite()
txn, js, cfg := createTransactionWithEDU(ctx, edus)
- received := atomic.NewBool(false)
+ received := atomic.Bool{}
onMessage := func(ctx context.Context, msgs []*nats.Msg) bool {
msg := msgs[0] // Guaranteed to exist if onMessage is called
diff --git a/setup/base/base.go b/setup/base/base.go
index 455337e59..82068aa92 100644
--- a/setup/base/base.go
+++ b/setup/base/base.go
@@ -28,13 +28,13 @@ import (
_ "net/http/pprof"
"os"
"os/signal"
+ "sync/atomic"
"syscall"
"time"
sentryhttp "github.com/getsentry/sentry-go/http"
"github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/prometheus/client_golang/prometheus/promhttp"
- "go.uber.org/atomic"
"github.com/gorilla/mux"
"github.com/kardianos/minwinsvc"
diff --git a/setup/base/sanity_other.go b/setup/base/sanity_other.go
index d35c2e872..38e2b941f 100644
--- a/setup/base/sanity_other.go
+++ b/setup/base/sanity_other.go
@@ -1,5 +1,5 @@
-//go:build !linux && !darwin && !netbsd && !freebsd && !openbsd && !solaris && !dragonfly && !aix
-// +build !linux,!darwin,!netbsd,!freebsd,!openbsd,!solaris,!dragonfly,!aix
+//go:build !unix
+// +build !unix
package base
diff --git a/setup/base/sanity_unix.go b/setup/base/sanity_unix.go
index 0403df1a8..90e38a6db 100644
--- a/setup/base/sanity_unix.go
+++ b/setup/base/sanity_unix.go
@@ -1,5 +1,5 @@
-//go:build linux || darwin || netbsd || freebsd || openbsd || solaris || dragonfly || aix
-// +build linux darwin netbsd freebsd openbsd solaris dragonfly aix
+//go:build unix
+// +build unix
package base