From 55b36dd056b2b65f684ea94ddcbd4eedfa59fc2a Mon Sep 17 00:00:00 2001 From: "R.B. Boyer" <4903+rboyer@users.noreply.github.com> Date: Mon, 20 Sep 2021 11:07:11 -0500 Subject: [PATCH] xds: ensure the active streams counters are 64 bit aligned on 32 bit systems (#11085) --- .changelog/11085.txt | 3 +++ agent/xds/server.go | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changelog/11085.txt diff --git a/.changelog/11085.txt b/.changelog/11085.txt new file mode 100644 index 000000000..9e437265e --- /dev/null +++ b/.changelog/11085.txt @@ -0,0 +1,3 @@ +```release-note:bug +xds: ensure the active streams counters are 64 bit aligned on 32 bit systems +``` diff --git a/agent/xds/server.go b/agent/xds/server.go index a9b4c220b..1763448cd 100644 --- a/agent/xds/server.go +++ b/agent/xds/server.go @@ -152,11 +152,12 @@ type Server struct { DisableV2Protocol bool - activeStreams activeStreamCounters + activeStreams *activeStreamCounters } // activeStreamCounters simply encapsulates two counters accessed atomically to -// ensure alignment is correct. +// ensure alignment is correct. This further requires that activeStreamCounters +// be a pointer field. type activeStreamCounters struct { xDSv3 uint64 xDSv2 uint64 @@ -197,6 +198,7 @@ func NewServer( CheckFetcher: checkFetcher, CfgFetcher: cfgFetcher, AuthCheckFrequency: DefaultAuthCheckFrequency, + activeStreams: &activeStreamCounters{}, } }