-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
The xDS resolver currently implements an interceptorList struct that chains all the HTTP filters on the client and runs them one after the other. See:
| type interceptorList struct { |
When a new config selector is created by the xDS resolver, it creates an interceptorList for every weighted cluster within every route. See:
grpc-go/internal/xds/resolver/xds_resolver.go
Line 390 in 19e4128
| interceptor, err := newInterceptor(r.xdsConfig.Listener.APIListener.HTTPFilters, wc.HTTPFilterConfigOverride, rt.HTTPFilterConfigOverride, r.xdsConfig.VirtualHost.HTTPFilterConfigOverride) |
When the config selector is asked to return matching configuration for an RPC, it returns this interceptorList as part of the RPCConfig. See:
| Interceptor: cluster.interceptor, |
When an RPC is initiated and a new stream is being created for it, the config selector is invoked and the interceptors are run here:
Line 273 in 19e4128
| cs, err := rpcConfig.Interceptor.NewStream(ctx, rpcInfo, done, ns) |
But the NewStream method on the interceptorList ignores the done callback passed to it, and instead passes an empty function to the chain of interceptors. See:
| return newStream(ctx, func() {}) |
Also, newClientStream passes an empty function as the done callback as well here:
Line 282 in 19e4128
| return newStream(ctx, func() {}) |
- Should the
interceptorListignore thedonecallback? - Should
newClientStreampass an empty function as thedonecallback? - With the filter state retention changes that we are making as part of A83, when a Filter instance shares some state to all of its interceptors, it would have to know exactly when the interceptors are done. Filters that share state could still wrap the the
donecallback passed to them inNewStreamand do whatever they have to do when the interceptor is done.