Description:
Describe the issue.
There is a nil check in the
|
if r.cache == nil { |
|
r.Logger.Error(err, "failed to init snapshot cache") |
|
} else { |
However, r.cache is initialized in
|
r.cache = cache.NewSnapshotCache(false, r.Logger) |
and
NewSnapshotCache never returns a nil from it:
|
func NewSnapshotCache(ads bool, logger logr.Logger) SnapshotCacheWithCallbacks { |
|
// Set up the nasty wrapper hack. |
|
wrappedLogger := NewLogrWrapper(logger) |
|
return &snapshotCache{ |
|
SnapshotCache: cachev3.NewSnapshotCache(ads, &Hash, wrappedLogger), |
|
log: wrappedLogger, |
|
lastSnapshot: make(snapshotMap), |
|
streamIDNodeInfo: make(nodeInfoMap), |
|
} |
|
} |
IMHO, the logger message is suspicious because the code around doesn't init snapshot cache. It could be a remnant of a previous refactor.
[optional Relevant Links:]
Any extra documentation required to understand the issue.
Description:
There is a nil check in the
gateway/internal/xds/server/runner/runner.go
Lines 137 to 139 in 9036533
However,
r.cacheis initialized ingateway/internal/xds/server/runner/runner.go
Line 80 in 9036533
NewSnapshotCachenever returns a nil from it:gateway/internal/xds/cache/snapshotcache.go
Lines 108 to 117 in 9036533
IMHO, the logger message is suspicious because the code around doesn't
init snapshot cache. It could be a remnant of a previous refactor.[optional Relevant Links:]