Skip to content

Commit 9ae7991

Browse files
authored
Merge pull request #346 from splitio/FME-15789
Added validation if err is nil to avoid null pointer exceptions
2 parents d8ee485 + 6cf095f commit 9ae7991

11 files changed

Lines changed: 304 additions & 34 deletions

File tree

.github/workflows/s3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Go
2626
uses: actions/setup-go@v6
2727
with:
28-
go-version: '1.26.2'
28+
go-version: '1.26.3'
2929

3030
- name: Create build folder
3131
run: mkdir -p build

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Go
3030
uses: actions/setup-go@v6
3131
with:
32-
go-version: '1.26.2'
32+
go-version: '1.26.3'
3333

3434
- name: Get version
3535
run: echo "VERSION=$(awk '/^const Version/{gsub(/"/, "", $4); print $4}' splitio/version.go)" >> $GITHUB_ENV

docker/Dockerfile.proxy

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Build stage
2-
FROM golang:1.26.2-trixie AS builder
2+
FROM golang:1.26.3-trixie AS builder
33

44
ARG EXTRA_BUILD_ARGS
55
ARG FIPS_MODE
66

7-
RUN apt update -y
8-
RUN apt install -y build-essential ca-certificates python3 git
7+
RUN apt update && \
8+
apt install -y --no-install-recommends build-essential ca-certificates python3 git && \
9+
rm -rf /var/lib/apt/lists/*
910

1011
WORKDIR /code
1112

@@ -19,9 +20,10 @@ RUN bash -c 'if [[ "${FIPS_MODE}" = "enabled" ]]; \
1920
# Runner stage
2021
FROM debian:13.4 AS runner
2122

22-
RUN apt update -y
23-
RUN apt upgrade -y
24-
RUN apt install -y bash ca-certificates
23+
RUN apt update -y && \
24+
apt upgrade -y && \
25+
apt install -y bash ca-certificates && \
26+
rm -rf /var/lib/apt/lists/*
2527
RUN groupadd -g 1000 split-proxy
2628
RUN useradd -r -u 1000 -g split-proxy -s /usr/sbin/nologin split-proxy
2729

docker/Dockerfile.synchronizer

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM golang:1.26.2-trixie AS builder
2+
FROM golang:1.26.3-trixie AS builder
33

44
ARG EXTRA_BUILD_ARGS
55
ARG FIPS_MODE
@@ -20,9 +20,10 @@ RUN bash -c 'if [[ "${FIPS_MODE}" = "enabled" ]]; \
2020
# Runner stage
2121
FROM debian:13.4 AS runner
2222

23-
RUN apt update -y
24-
RUN apt upgrade -y
25-
RUN apt install -y bash ca-certificates
23+
RUN apt update -y && \
24+
apt upgrade -y && \
25+
apt install -y bash ca-certificates && \
26+
rm -rf /var/lib/apt/lists/*
2627
RUN groupadd -g 1000 split-synchronizer
2728
RUN useradd -r -u 1000 -g split-synchronizer -s /usr/sbin/nologin split-synchronizer
2829

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/splitio/split-synchronizer/v5
22

3-
go 1.26.2
3+
go 1.26.3
44

55
require (
66
github.com/gin-contrib/cors v1.6.0

go.sum

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,20 @@ github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA
9797
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
9898
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
9999
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
100-
golang.org/x/arch v0.25.0 h1:qnk6Ksugpi5Bz32947rkUgDt9/s5qvqDPl/gBKdMJLE=
101-
golang.org/x/arch v0.25.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8=
102100
golang.org/x/arch v0.26.0 h1:jZ6dpec5haP/fUv1kLCbuJy6dnRrfX6iVK08lZBFpk4=
103101
golang.org/x/arch v0.26.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8=
104-
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
105-
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
106102
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
107103
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
108104
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
109105
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
110-
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
111-
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
112-
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
113-
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
114106
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
115107
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
116108
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
117109
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
118110
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
119111
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
120-
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
121-
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
122112
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
123113
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
124-
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
125-
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
126114
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
127115
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
128116
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=

splitio/proxy/caching/workers.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ func (c *CacheAwareSplitSynchronizer) SynchronizeSplits(till *int64) (*split.Upd
4949
previousRB, _ := c.rbStorage.ChangeNumber()
5050

5151
result, err := c.wrapped.SynchronizeSplits(till)
52+
if err != nil {
53+
return nil, err
54+
}
5255
current, _ := c.splitStorage.ChangeNumber()
5356
currentRB, _ := c.rbStorage.ChangeNumber()
5457
if current > previous || (previous != -1 && current == -1) || currentRB > previousRB || (previousRB != -1 && currentRB == -1) {
@@ -71,6 +74,9 @@ func (c *CacheAwareSplitSynchronizer) SynchronizeFeatureFlags(ffChange *dtos.Spl
7174
previousRB, _ := c.rbStorage.ChangeNumber()
7275

7376
result, err := c.wrapped.SynchronizeFeatureFlags(ffChange)
77+
if err != nil {
78+
return nil, err
79+
}
7480
current, _ := c.splitStorage.ChangeNumber()
7581
currentRB, _ := c.rbStorage.ChangeNumber()
7682
if current > previous || (previous != -1 && current == -1) || currentRB > previousRB || (previousRB != -1 && currentRB == -1) {
@@ -111,6 +117,9 @@ func NewCacheAwareSegmentSync(
111117
func (c *CacheAwareSegmentSynchronizer) SynchronizeSegment(name string, till *int64) (*segment.UpdateResult, error) {
112118
previous, _ := c.segmentStorage.ChangeNumber(name)
113119
result, err := c.wrapped.SynchronizeSegment(name, till)
120+
if err != nil {
121+
return nil, err
122+
}
114123
if current := result.NewChangeNumber; current > previous || (previous != -1 && current == -1) {
115124
c.cacheFlusher.EvictBySurrogate(MakeSurrogateForSegmentChanges(name))
116125
c.cacheFlusher.EvictBySurrogate(MembershipsSurrogate)
@@ -139,6 +148,9 @@ func (c *CacheAwareSegmentSynchronizer) SynchronizeSegments() (map[string]segmen
139148
}
140149

141150
results, err := c.wrapped.SynchronizeSegments()
151+
if err != nil {
152+
return nil, err
153+
}
142154
for segmentName := range results {
143155
result := results[segmentName]
144156
ccn := result.NewChangeNumber
@@ -197,6 +209,9 @@ func NewCacheAwareLargeSegmentSync(
197209
func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegment(name string, till *int64) (*int64, error) {
198210
previous := c.largeSegmentStorage.ChangeNumber(name)
199211
newCN, err := c.wrapped.SynchronizeLargeSegment(name, till)
212+
if err != nil {
213+
return nil, err
214+
}
200215

201216
c.evictByLargeSegmentSurrogate(previous, *newCN)
202217

@@ -214,6 +229,9 @@ func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegments() (map[str
214229
}
215230

216231
results, err := c.wrapped.SynchronizeLargeSegments()
232+
if err != nil {
233+
return nil, err
234+
}
217235
for name, currentCN := range results {
218236
c.evictByLargeSegmentSurrogate(previousCNs[name], *currentCN)
219237
}
@@ -228,6 +246,9 @@ func (c *CacheAwareLargeSegmentSynchronizer) IsCached(name string) bool {
228246
func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegmentUpdate(lsRFDResponseDTO *dtos.LargeSegmentRFDResponseDTO) (*int64, error) {
229247
previous := c.largeSegmentStorage.ChangeNumber(lsRFDResponseDTO.Name)
230248
newCN, err := c.wrapped.SynchronizeLargeSegmentUpdate(lsRFDResponseDTO)
249+
if err != nil {
250+
return nil, err
251+
}
231252

232253
c.evictByLargeSegmentSurrogate(previous, *newCN)
233254

0 commit comments

Comments
 (0)