diff --git a/.changelog/15160.txt b/.changelog/15160.txt new file mode 100644 index 0000000000..8cfda548f5 --- /dev/null +++ b/.changelog/15160.txt @@ -0,0 +1,3 @@ +```release-note:bug +peering: fix nil pointer in calling handleUpdateService +``` \ No newline at end of file diff --git a/agent/grpc-external/services/peerstream/replication.go b/agent/grpc-external/services/peerstream/replication.go index c43262b053..908c6d2457 100644 --- a/agent/grpc-external/services/peerstream/replication.go +++ b/agent/grpc-external/services/peerstream/replication.go @@ -287,7 +287,6 @@ func (s *Server) handleUpsertExportedServiceList( if err != nil { return err } - for _, sn := range serviceList { if _, ok := exportedServices[sn]; !ok { err := s.handleUpdateService(peerName, partition, sn, nil) @@ -324,9 +323,12 @@ func (s *Server) handleUpdateService( return fmt.Errorf("failed to read imported services: %w", err) } - structsNodes, err := export.CheckServiceNodesToStruct() - if err != nil { - return fmt.Errorf("failed to convert protobuf instances to structs: %w", err) + structsNodes := []structs.CheckServiceNode{} + if export != nil { + structsNodes, err = export.CheckServiceNodesToStruct() + if err != nil { + return fmt.Errorf("failed to convert protobuf instances to structs: %w", err) + } } // Normalize the data into a convenient form for operation.