From 8cade2a18c7c358b0212882ff53fb0c35680495b Mon Sep 17 00:00:00 2001 From: Purnesh Dixit Date: Sun, 22 Dec 2024 03:48:19 +0530 Subject: [PATCH] nil check for r.cc in r.onError, before calling r.cc.ReportError(err) --- xds/internal/resolver/xds_resolver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xds/internal/resolver/xds_resolver.go b/xds/internal/resolver/xds_resolver.go index a8a2c40fa288..4d38b4919668 100644 --- a/xds/internal/resolver/xds_resolver.go +++ b/xds/internal/resolver/xds_resolver.go @@ -460,6 +460,10 @@ func (r *xdsResolver) applyRouteConfigUpdate(update xdsresource.RouteConfigUpdat // // Only executed in the context of a serializer callback. func (r *xdsResolver) onError(err error) { + if r.cc == nil { + r.logger.Warningf("Resolver closed, dropping error: %v", err) + return + } r.cc.ReportError(err) }