Skip to content

In LinearCache, respond can't tell the caller is from update or delete. #540

Open
@fscnick

Description

@fscnick

UpdateResource and DeleteResource will call notifyAll once it has changes. And It respond the resource that has been changed.

func (cache *LinearCache) notifyAll(modified map[string]struct{}) {
// de-duplicate watches that need to be responded
notifyList := make(map[chan Response][]string)
for name := range modified {
for watch := range cache.watches[name] {
notifyList[watch] = append(notifyList[watch], name)
}
delete(cache.watches, name)
}
for value, stale := range notifyList {
cache.respond(value, stale)
}

However, the xds-client get the response. It would remove the resources that aren't in the response from local cache.
https://github.com/grpc/grpc-go/blob/011544f72939c85397b0e24378280e6075061cb1/xds/internal/xdsclient/pubsub/update.go#L227-L240

Thus, a DeleteResource has been called, the xds-server would respond the deleted resource. But the resource has been deleted, actually it's empty. The xds-client remove the other resource not in the response from its local cache. it causes the grpc-client is unable to connect to other endpoints that haven't been deleted.

for _, name := range staleResources {
resource := cache.resources[name]
if resource != nil {
resources = append(resources, types.ResourceWithTTL{Resource: resource})
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions