rebase: bump google.golang.org/grpc from 1.72.0 to 1.72.1

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.72.0 to 1.72.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.72.0...v1.72.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.72.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2025-05-19 20:45:34 +00:00 committed by mergify[bot]
parent f65f306d27
commit f6c26d354c
7 changed files with 126 additions and 66 deletions

2
go.mod
View File

@ -33,7 +33,7 @@ require (
golang.org/x/crypto v0.38.0 golang.org/x/crypto v0.38.0
golang.org/x/net v0.40.0 golang.org/x/net v0.40.0
golang.org/x/sys v0.33.0 golang.org/x/sys v0.33.0
google.golang.org/grpc v1.72.0 google.golang.org/grpc v1.72.1
google.golang.org/protobuf v1.36.6 google.golang.org/protobuf v1.36.6
k8s.io/api v0.33.0 k8s.io/api v0.33.0
k8s.io/apimachinery v0.33.0 k8s.io/apimachinery v0.33.0

4
go.sum
View File

@ -1291,8 +1291,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA=
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=

View File

@ -28,6 +28,8 @@ import (
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/proxyattributes" "google.golang.org/grpc/internal/proxyattributes"
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/internal/transport/networktype"
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/serviceconfig"
) )
@ -40,7 +42,7 @@ var (
// delegatingResolver manages both target URI and proxy address resolution by // delegatingResolver manages both target URI and proxy address resolution by
// delegating these tasks to separate child resolvers. Essentially, it acts as // delegating these tasks to separate child resolvers. Essentially, it acts as
// a intermediary between the gRPC ClientConn and the child resolvers. // an intermediary between the gRPC ClientConn and the child resolvers.
// //
// It implements the [resolver.Resolver] interface. // It implements the [resolver.Resolver] interface.
type delegatingResolver struct { type delegatingResolver struct {
@ -48,6 +50,9 @@ type delegatingResolver struct {
cc resolver.ClientConn // gRPC ClientConn cc resolver.ClientConn // gRPC ClientConn
proxyURL *url.URL // proxy URL, derived from proxy environment and target proxyURL *url.URL // proxy URL, derived from proxy environment and target
// We do not hold both mu and childMu in the same goroutine. Avoid holding
// both locks when calling into the child, as the child resolver may
// synchronously callback into the channel.
mu sync.Mutex // protects all the fields below mu sync.Mutex // protects all the fields below
targetResolverState *resolver.State // state of the target resolver targetResolverState *resolver.State // state of the target resolver
proxyAddrs []resolver.Address // resolved proxy addresses; empty if no proxy is configured proxyAddrs []resolver.Address // resolved proxy addresses; empty if no proxy is configured
@ -66,8 +71,8 @@ func (nopResolver) ResolveNow(resolver.ResolveNowOptions) {}
func (nopResolver) Close() {} func (nopResolver) Close() {}
// proxyURLForTarget determines the proxy URL for the given address based on // proxyURLForTarget determines the proxy URL for the given address based on the
// the environment. It can return the following: // environment. It can return the following:
// - nil URL, nil error: No proxy is configured or the address is excluded // - nil URL, nil error: No proxy is configured or the address is excluded
// using the `NO_PROXY` environment variable or if req.URL.Host is // using the `NO_PROXY` environment variable or if req.URL.Host is
// "localhost" (with or without // a port number) // "localhost" (with or without // a port number)
@ -86,7 +91,8 @@ func proxyURLForTarget(address string) (*url.URL, error) {
// resolvers: // resolvers:
// - one to resolve the proxy address specified using the supported // - one to resolve the proxy address specified using the supported
// environment variables. This uses the registered resolver for the "dns" // environment variables. This uses the registered resolver for the "dns"
// scheme. // scheme. It is lazily built when a target resolver update contains at least
// one TCP address.
// - one to resolve the target URI using the resolver specified by the scheme // - one to resolve the target URI using the resolver specified by the scheme
// in the target URI or specified by the user using the WithResolvers dial // in the target URI or specified by the user using the WithResolvers dial
// option. As a special case, if the target URI's scheme is "dns" and a // option. As a special case, if the target URI's scheme is "dns" and a
@ -95,8 +101,10 @@ func proxyURLForTarget(address string) (*url.URL, error) {
// resolution is enabled using the dial option. // resolution is enabled using the dial option.
func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions, targetResolverBuilder resolver.Builder, targetResolutionEnabled bool) (resolver.Resolver, error) { func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions, targetResolverBuilder resolver.Builder, targetResolutionEnabled bool) (resolver.Resolver, error) {
r := &delegatingResolver{ r := &delegatingResolver{
target: target, target: target,
cc: cc, cc: cc,
proxyResolver: nopResolver{},
targetResolver: nopResolver{},
} }
var err error var err error
@ -123,37 +131,26 @@ func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOpti
// resolution should be handled by the proxy, not the client. Therefore, we // resolution should be handled by the proxy, not the client. Therefore, we
// bypass the target resolver and store the unresolved target address. // bypass the target resolver and store the unresolved target address.
if target.URL.Scheme == "dns" && !targetResolutionEnabled { if target.URL.Scheme == "dns" && !targetResolutionEnabled {
state := resolver.State{ r.targetResolverState = &resolver.State{
Addresses: []resolver.Address{{Addr: target.Endpoint()}}, Addresses: []resolver.Address{{Addr: target.Endpoint()}},
Endpoints: []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: target.Endpoint()}}}}, Endpoints: []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: target.Endpoint()}}}},
} }
r.targetResolverState = &state r.updateTargetResolverState(*r.targetResolverState)
} else { return r, nil
wcc := &wrappingClientConn{
stateListener: r.updateTargetResolverState,
parent: r,
}
if r.targetResolver, err = targetResolverBuilder.Build(target, wcc, opts); err != nil {
return nil, fmt.Errorf("delegating_resolver: unable to build the resolver for target %s: %v", target, err)
}
} }
wcc := &wrappingClientConn{
if r.proxyResolver, err = r.proxyURIResolver(opts); err != nil { stateListener: r.updateTargetResolverState,
return nil, fmt.Errorf("delegating_resolver: failed to build resolver for proxy URL %q: %v", r.proxyURL, err) parent: r,
} }
if r.targetResolver, err = targetResolverBuilder.Build(target, wcc, opts); err != nil {
if r.targetResolver == nil { return nil, fmt.Errorf("delegating_resolver: unable to build the resolver for target %s: %v", target, err)
r.targetResolver = nopResolver{}
}
if r.proxyResolver == nil {
r.proxyResolver = nopResolver{}
} }
return r, nil return r, nil
} }
// proxyURIResolver creates a resolver for resolving proxy URIs using the // proxyURIResolver creates a resolver for resolving proxy URIs using the "dns"
// "dns" scheme. It adjusts the proxyURL to conform to the "dns:///" format and // scheme. It adjusts the proxyURL to conform to the "dns:///" format and builds
// builds a resolver with a wrappingClientConn to capture resolved addresses. // a resolver with a wrappingClientConn to capture resolved addresses.
func (r *delegatingResolver) proxyURIResolver(opts resolver.BuildOptions) (resolver.Resolver, error) { func (r *delegatingResolver) proxyURIResolver(opts resolver.BuildOptions) (resolver.Resolver, error) {
proxyBuilder := resolver.Get("dns") proxyBuilder := resolver.Get("dns")
if proxyBuilder == nil { if proxyBuilder == nil {
@ -189,18 +186,43 @@ func (r *delegatingResolver) Close() {
r.proxyResolver = nil r.proxyResolver = nil
} }
// updateClientConnStateLocked creates a list of combined addresses by func networkTypeFromAddr(addr resolver.Address) string {
// pairing each proxy address with every target address. For each pair, it networkType, ok := networktype.Get(addr)
// generates a new [resolver.Address] using the proxy address, and adding the if !ok {
// target address as the attribute along with user info. It returns nil if networkType, _ = transport.ParseDialTarget(addr.Addr)
// either resolver has not sent update even once and returns the error from }
// ClientConn update once both resolvers have sent update atleast once. return networkType
}
func isTCPAddressPresent(state *resolver.State) bool {
for _, addr := range state.Addresses {
if networkType := networkTypeFromAddr(addr); networkType == "tcp" {
return true
}
}
for _, endpoint := range state.Endpoints {
for _, addr := range endpoint.Addresses {
if networktype := networkTypeFromAddr(addr); networktype == "tcp" {
return true
}
}
}
return false
}
// updateClientConnStateLocked constructs a combined list of addresses by
// pairing each proxy address with every target address of type TCP. For each
// pair, it creates a new [resolver.Address] using the proxy address and
// attaches the corresponding target address and user info as attributes. Target
// addresses that are not of type TCP are appended to the list as-is. The
// function returns nil if either resolver has not yet provided an update, and
// returns the result of ClientConn.UpdateState once both resolvers have
// provided at least one update.
func (r *delegatingResolver) updateClientConnStateLocked() error { func (r *delegatingResolver) updateClientConnStateLocked() error {
if r.targetResolverState == nil || r.proxyAddrs == nil { if r.targetResolverState == nil || r.proxyAddrs == nil {
return nil return nil
} }
curState := *r.targetResolverState
// If multiple resolved proxy addresses are present, we send only the // If multiple resolved proxy addresses are present, we send only the
// unresolved proxy host and let net.Dial handle the proxy host name // unresolved proxy host and let net.Dial handle the proxy host name
// resolution when creating the transport. Sending all resolved addresses // resolution when creating the transport. Sending all resolved addresses
@ -218,24 +240,30 @@ func (r *delegatingResolver) updateClientConnStateLocked() error {
} }
var addresses []resolver.Address var addresses []resolver.Address
for _, targetAddr := range (*r.targetResolverState).Addresses { for _, targetAddr := range (*r.targetResolverState).Addresses {
// Avoid proxy when network is not tcp.
if networkType := networkTypeFromAddr(targetAddr); networkType != "tcp" {
addresses = append(addresses, targetAddr)
continue
}
addresses = append(addresses, proxyattributes.Set(proxyAddr, proxyattributes.Options{ addresses = append(addresses, proxyattributes.Set(proxyAddr, proxyattributes.Options{
User: r.proxyURL.User, User: r.proxyURL.User,
ConnectAddr: targetAddr.Addr, ConnectAddr: targetAddr.Addr,
})) }))
} }
// Create a list of combined endpoints by pairing all proxy endpoints // For each target endpoint, construct a new [resolver.Endpoint] that
// with every target endpoint. Each time, it constructs a new // includes all addresses from all proxy endpoints and the addresses from
// [resolver.Endpoint] using the all addresses from all the proxy endpoint // that target endpoint, preserving the number of target endpoints.
// and the target addresses from one endpoint. The target address and user
// information from the proxy URL are added as attributes to the proxy
// address.The resulting list of addresses is then grouped into endpoints,
// covering all combinations of proxy and target endpoints.
var endpoints []resolver.Endpoint var endpoints []resolver.Endpoint
for _, endpt := range (*r.targetResolverState).Endpoints { for _, endpt := range (*r.targetResolverState).Endpoints {
var addrs []resolver.Address var addrs []resolver.Address
for _, proxyAddr := range r.proxyAddrs { for _, targetAddr := range endpt.Addresses {
for _, targetAddr := range endpt.Addresses { // Avoid proxy when network is not tcp.
if networkType := networkTypeFromAddr(targetAddr); networkType != "tcp" {
addrs = append(addrs, targetAddr)
continue
}
for _, proxyAddr := range r.proxyAddrs {
addrs = append(addrs, proxyattributes.Set(proxyAddr, proxyattributes.Options{ addrs = append(addrs, proxyattributes.Set(proxyAddr, proxyattributes.Options{
User: r.proxyURL.User, User: r.proxyURL.User,
ConnectAddr: targetAddr.Addr, ConnectAddr: targetAddr.Addr,
@ -246,8 +274,9 @@ func (r *delegatingResolver) updateClientConnStateLocked() error {
} }
// Use the targetResolverState for its service config and attributes // Use the targetResolverState for its service config and attributes
// contents. The state update is only sent after both the target and proxy // contents. The state update is only sent after both the target and proxy
// resolvers have sent their updates, and curState has been updated with // resolvers have sent their updates, and curState has been updated with the
// the combined addresses. // combined addresses.
curState := *r.targetResolverState
curState.Addresses = addresses curState.Addresses = addresses
curState.Endpoints = endpoints curState.Endpoints = endpoints
return r.cc.UpdateState(curState) return r.cc.UpdateState(curState)
@ -257,7 +286,8 @@ func (r *delegatingResolver) updateClientConnStateLocked() error {
// addresses and endpoints, marking the resolver as ready, and triggering a // addresses and endpoints, marking the resolver as ready, and triggering a
// state update if both proxy and target resolvers are ready. If the ClientConn // state update if both proxy and target resolvers are ready. If the ClientConn
// returns a non-nil error, it calls `ResolveNow()` on the target resolver. It // returns a non-nil error, it calls `ResolveNow()` on the target resolver. It
// is a StateListener function of wrappingClientConn passed to the proxy resolver. // is a StateListener function of wrappingClientConn passed to the proxy
// resolver.
func (r *delegatingResolver) updateProxyResolverState(state resolver.State) error { func (r *delegatingResolver) updateProxyResolverState(state resolver.State) error {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
@ -265,8 +295,8 @@ func (r *delegatingResolver) updateProxyResolverState(state resolver.State) erro
logger.Infof("Addresses received from proxy resolver: %s", state.Addresses) logger.Infof("Addresses received from proxy resolver: %s", state.Addresses)
} }
if len(state.Endpoints) > 0 { if len(state.Endpoints) > 0 {
// We expect exactly one address per endpoint because the proxy // We expect exactly one address per endpoint because the proxy resolver
// resolver uses "dns" resolution. // uses "dns" resolution.
r.proxyAddrs = make([]resolver.Address, 0, len(state.Endpoints)) r.proxyAddrs = make([]resolver.Address, 0, len(state.Endpoints))
for _, endpoint := range state.Endpoints { for _, endpoint := range state.Endpoints {
r.proxyAddrs = append(r.proxyAddrs, endpoint.Addresses...) r.proxyAddrs = append(r.proxyAddrs, endpoint.Addresses...)
@ -294,11 +324,14 @@ func (r *delegatingResolver) updateProxyResolverState(state resolver.State) erro
return err return err
} }
// updateTargetResolverState updates the target resolver state by storing target // updateTargetResolverState is the StateListener function provided to the
// addresses, endpoints, and service config, marking the resolver as ready, and // target resolver via wrappingClientConn. It updates the resolver state and
// triggering a state update if both resolvers are ready. If the ClientConn // marks the target resolver as ready. If the update includes at least one TCP
// returns a non-nil error, it calls `ResolveNow()` on the proxy resolver. It // address and the proxy resolver has not yet been constructed, it initializes
// is a StateListener function of wrappingClientConn passed to the target resolver. // the proxy resolver. A combined state update is triggered once both resolvers
// are ready. If all addresses are non-TCP, it proceeds without waiting for the
// proxy resolver. If ClientConn.UpdateState returns a non-nil error,
// ResolveNow() is called on the proxy resolver.
func (r *delegatingResolver) updateTargetResolverState(state resolver.State) error { func (r *delegatingResolver) updateTargetResolverState(state resolver.State) error {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
@ -307,6 +340,31 @@ func (r *delegatingResolver) updateTargetResolverState(state resolver.State) err
logger.Infof("Addresses received from target resolver: %v", state.Addresses) logger.Infof("Addresses received from target resolver: %v", state.Addresses)
} }
r.targetResolverState = &state r.targetResolverState = &state
// If no addresses returned by resolver have network type as tcp , do not
// wait for proxy update.
if !isTCPAddressPresent(r.targetResolverState) {
return r.cc.UpdateState(*r.targetResolverState)
}
// The proxy resolver may be rebuilt multiple times, specifically each time
// the target resolver sends an update, even if the target resolver is built
// successfully but building the proxy resolver fails.
if len(r.proxyAddrs) == 0 {
go func() {
r.childMu.Lock()
defer r.childMu.Unlock()
if _, ok := r.proxyResolver.(nopResolver); !ok {
return
}
proxyResolver, err := r.proxyURIResolver(resolver.BuildOptions{})
if err != nil {
r.cc.ReportError(fmt.Errorf("delegating_resolver: unable to build the proxy resolver: %v", err))
return
}
r.proxyResolver = proxyResolver
}()
}
err := r.updateClientConnStateLocked() err := r.updateClientConnStateLocked()
if err != nil { if err != nil {
go func() { go func() {
@ -335,7 +393,8 @@ func (wcc *wrappingClientConn) UpdateState(state resolver.State) error {
return wcc.stateListener(state) return wcc.stateListener(state)
} }
// ReportError intercepts errors from the child resolvers and passes them to ClientConn. // ReportError intercepts errors from the child resolvers and passes them to
// ClientConn.
func (wcc *wrappingClientConn) ReportError(err error) { func (wcc *wrappingClientConn) ReportError(err error) {
wcc.parent.cc.ReportError(err) wcc.parent.cc.ReportError(err)
} }
@ -346,8 +405,8 @@ func (wcc *wrappingClientConn) NewAddress(addrs []resolver.Address) {
wcc.UpdateState(resolver.State{Addresses: addrs}) wcc.UpdateState(resolver.State{Addresses: addrs})
} }
// ParseServiceConfig parses the provided service config and returns an // ParseServiceConfig parses the provided service config and returns an object
// object that provides the parsed config. // that provides the parsed config.
func (wcc *wrappingClientConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult { func (wcc *wrappingClientConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
return wcc.parent.cc.ParseServiceConfig(serviceConfigJSON) return wcc.parent.cc.ParseServiceConfig(serviceConfigJSON)
} }

View File

@ -176,7 +176,7 @@ func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error
return fn(ctx, address) return fn(ctx, address)
} }
if !ok { if !ok {
networkType, address = parseDialTarget(address) networkType, address = ParseDialTarget(address)
} }
if opts, present := proxyattributes.Get(addr); present { if opts, present := proxyattributes.Get(addr); present {
return proxyDial(ctx, addr, grpcUA, opts) return proxyDial(ctx, addr, grpcUA, opts)
@ -1242,7 +1242,8 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
statusCode = codes.DeadlineExceeded statusCode = codes.DeadlineExceeded
} }
} }
t.closeStream(s, io.EOF, false, http2.ErrCodeNo, status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode), nil, false) st := status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode)
t.closeStream(s, st.Err(), false, http2.ErrCodeNo, st, nil, false)
} }
func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) {

View File

@ -439,8 +439,8 @@ func getWriteBufferPool(size int) *sync.Pool {
return pool return pool
} }
// parseDialTarget returns the network and address to pass to dialer. // ParseDialTarget returns the network and address to pass to dialer.
func parseDialTarget(target string) (string, string) { func ParseDialTarget(target string) (string, string) {
net := "tcp" net := "tcp"
m1 := strings.Index(target, ":") m1 := strings.Index(target, ":")
m2 := strings.Index(target, ":/") m2 := strings.Index(target, ":/")

View File

@ -19,4 +19,4 @@
package grpc package grpc
// Version is the current grpc version. // Version is the current grpc version.
const Version = "1.72.0" const Version = "1.72.1"

2
vendor/modules.txt vendored
View File

@ -593,7 +593,7 @@ gomodules.xyz/jsonpatch/v2
# google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a # google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a
## explicit; go 1.22 ## explicit; go 1.22
google.golang.org/genproto/googleapis/rpc/status google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.72.0 # google.golang.org/grpc v1.72.1
## explicit; go 1.23 ## explicit; go 1.23
google.golang.org/grpc google.golang.org/grpc
google.golang.org/grpc/attributes google.golang.org/grpc/attributes