upgrade to latest dependencies (#829)

bumping google.golang.org/genproto/googleapis/api 50ed04b...6c6643b:
  > 6c6643b chore(all): update all (# 1078)
  > a9fa171 fix(dataform): Remove broken aliases (# 1080)
  > 9144d31 fix(analytics): Remove broken aliases (# 1079)
  > 35c7eff chore(all): update all (# 1077)
bumping google.golang.org/genproto 50ed04b...a9fa171:
  > a9fa171 fix(dataform): Remove broken aliases (# 1080)
  > 9144d31 fix(analytics): Remove broken aliases (# 1079)
  > 35c7eff chore(all): update all (# 1077)
bumping knative.dev/pkg d34ca03...b6659cc:
  > b6659cc Bump cloud.google.com/go/storage from 1.36.0 to 1.37.0 (# 2948)
  > 9bdb511 Bump google.golang.org/grpc from 1.60.1 to 1.61.0 (# 2947)
bumping google.golang.org/grpc dbbcf59...8167bc3:
  > 8167bc3 Change version to 1.61.0 (# 6936)
  > 52e2363 test/xds: Use different import path for gRPC Messages (# 6933)
  > 67e50be transport: Remove redundant if in handleGoAway (# 6930)
  > e96f521 alts: Extract AuthInfo after handshake in ALTS e2e test. (# 6931)
  > 987df13 metadata: move FromOutgoingContextRaw() to internal (# 6765)
  > 61eab37 server: block GracefulStop on method handlers and make blocking optional for Stop (# 6922)
  > ddd377f xds/server: fix RDS handling for non-inline route configs (# 6915)
  > 8b455de removing Roots deprecated Subjects field in tests (# 6907)
  > 953d12a alts: Forward-fix of ALTS queuing of handshake requests. (# 6906)
  > 6ce73bf internal/transport: convert `ConnectionError` to `Unavailable` status when writing headers (# 6891)
  > e7e400b deps: apply `make proto` changes (# 6916)
  > 660c394 examples: Fixed the formatting in the Authentication README.md (# 6908)
  > 3a8270f grpc: skip compression of empty messages (# 6842)
  > 7e9d319 vet: remove ignore of CloseNotifier (# 6911)
  > 5a36bb7 fix 'identitiy' typo in error message   (# 6909)
  > a233d9b build(deps): bump the github-actions group with 1 update (# 6904)
  > 6bc1906 xds: add support for mTLS Credentials in xDS bootstrap (# 6757)
  > 71cc0f1 Revert "alts: Queue ALTS handshakes once limit is reached rather than dropping. (# 6884)" (# 6903)
  > 4f03f3f removing deprecated http closenotifier function (# 6886)
  > bb0d32f xds: don't fail channel/server startup when xds creds is specified, but bootstrap is missing certificate providers (# 6848)
  > e20d5ce reflection: rename non-regenerated pb.go files to not be called '.pb.go' (# 6885)
  > adc7685 alts: Queue ALTS handshakes once limit is reached rather than dropping. (# 6884)
  > 33a60a8 internal: use OS defaults for TCP keepalive params in Windows (# 6863)
  > c109241 interop/xds: Increase go log verbosity to 99 so that EDS is logged (# 6860)
  > 02a4e93 orca: use atomic pointer instead of mutex in server metrics recorder to improve performance (# 6799)
  > df02c11 test/kokoro: Use the Kokoro shared install lib from the new repo (# 6859)
  > 444749d alts: Record network latency and pass it to the handshaker service. (# 6851)
  > 45624f0 grpc: eliminate panics in server worker implementation (# 6856)
  > 6e6914a completely delete WatchListener and WatchRouteConfig APIs (# 6849)
  > 836e5de credentials/alts: update handshaker.pb.go (# 6857)
  > 43e4461 Forbid dependabot from performing major version bumps (# 6852)
  > 686fdd8 security/advancedtls: fix test that relies on min TLS version (# 6824)
  > 52baf16 internal: use OS defaults for TCP keepalive params only on unix (# 6841)
  > d050906 build(deps): bump the github-actions group with 3 updates (# 6835)
  > 477bd62 xds/internal/resolver: switch to generic xDS API for LDS/RDS (# 6729)
  > a03c7f1 client: always enable TCP keepalives with OS defaults (# 6834)
  > c2398ce [infra] Hash-pin GitHub Actions, keep them updated with dependabot (# 6815)
  > 0866ce0 grpc: optional interface to provide channel authority (# 6752)
  > 5d7453e client: rework resolver and balancer wrappers to avoid deadlock (# 6804)
  > 93389b7 doc: fix link to the reflection protocol (# 6833)
  > 1b05500 internal/credentials/xds: Add exported comment for HandshakeInfo (# 6823)
  > 737f87b xds/internal/server: cleanup formatting directives in some logs (# 6820)
  > bc16b5f interop: support custom creds flag for stress test client (# 6809)
  > 02ea031 Bugfix for broken import (# 6816)
  > 287c473 Mark old CRL APIs as deprecated (# 6810)
  > 7935c4f resolver_wrapper: remove serializerScheduleLocked; the lock is unnecessary (# 6803)
  > 914ca65 client: further streamlining of Dial (# 6802)
  > 232054a client: remove deprecated WithServiceConfig DialOption (# 6800)
  > 42fdcc4 client: rename balancer and resolver wrapper files to be consistent (# 6801)
  > 59c0aec xDS: Atomically read and write xDS security configuration client side (# 6796)
  > ce3b538 client: simplify initialization and cleanup a bit (# 6798)
  > b98104e buffer & grpcsync: various cleanups and improvements (# 6785)
  > 424db25 credentials: if not set, restrict to TLS v1.2+ and CipherSuites per RFC7540 (# 6776)
  > 40c279a deps: update dependencies for all modules (# 6795)
  > 3cbbe29 reflection: don't serialize placeholders (# 6771)
  > 4a84ce6 Change version to 1.61.0-dev (# 6794)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
Knative Automation 2024-01-31 12:00:34 -05:00 committed by GitHub
parent 506882f82a
commit 0ea2d3c6dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 168 additions and 75 deletions

8
go.mod
View File

@ -12,7 +12,7 @@ require (
k8s.io/code-generator v0.28.5 k8s.io/code-generator v0.28.5
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9
knative.dev/hack v0.0.0-20240123160146-ab9b69024c39 knative.dev/hack v0.0.0-20240123160146-ab9b69024c39
knative.dev/pkg v0.0.0-20240129115945-d34ca0343c54 knative.dev/pkg v0.0.0-20240129160226-b6659cc45066
) )
require ( require (
@ -68,10 +68,10 @@ require (
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.159.0 // indirect google.golang.org/api v0.159.0 // indirect
google.golang.org/appengine v1.6.8 // indirect google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/grpc v1.60.1 // indirect google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect

16
go.sum
View File

@ -584,10 +584,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg=
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k=
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457 h1:KHBtwE+eQc3+NxpjmRFlQ3pJQ2FNnhhgB9xOV8kyBuU=
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@ -603,8 +603,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
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=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@ -668,8 +668,8 @@ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrC
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20240123160146-ab9b69024c39 h1:Or4ri7cAUQNEWwMPaGGaIe1hsPHGdVtr8lIaHh2JF7s= knative.dev/hack v0.0.0-20240123160146-ab9b69024c39 h1:Or4ri7cAUQNEWwMPaGGaIe1hsPHGdVtr8lIaHh2JF7s=
knative.dev/hack v0.0.0-20240123160146-ab9b69024c39/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= knative.dev/hack v0.0.0-20240123160146-ab9b69024c39/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/pkg v0.0.0-20240129115945-d34ca0343c54 h1:4a2uRJuQ53eZOrD7HG7xzSb8KOgctwkk+eVRIOpRpQ4= knative.dev/pkg v0.0.0-20240129160226-b6659cc45066 h1:CZSdKszK3MTCuchbQK643y/nHLQs87ESuFQn011XsJ8=
knative.dev/pkg v0.0.0-20240129115945-d34ca0343c54/go.mod h1:V7Qnk2Ic7hsekfxlmPF79hFURFupKOnb+AcO/ZCNuxw= knative.dev/pkg v0.0.0-20240129160226-b6659cc45066/go.mod h1:cGCJe6wkr0vQMAXTaUHi0XA/12JbxSTK15TnyBmn7ms=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

View File

@ -430,7 +430,7 @@ type ClientHeader struct {
MethodName string `protobuf:"bytes,2,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` MethodName string `protobuf:"bytes,2,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"`
// A single process may be used to run multiple virtual // A single process may be used to run multiple virtual
// servers with different identities. // servers with different identities.
// The authority is the name of such a server identitiy. // The authority is the name of such a server identity.
// It is typically a portion of the URI in the form of // It is typically a portion of the URI in the form of
// <host> or <host>:<port> . // <host> or <host>:<port> .
Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"`

View File

@ -1860,27 +1860,15 @@ func (cc *ClientConn) determineAuthority() error {
} }
endpoint := cc.parsedTarget.Endpoint() endpoint := cc.parsedTarget.Endpoint()
target := cc.target if authorityFromDialOption != "" {
switch {
case authorityFromDialOption != "":
cc.authority = authorityFromDialOption cc.authority = authorityFromDialOption
case authorityFromCreds != "": } else if authorityFromCreds != "" {
cc.authority = authorityFromCreds cc.authority = authorityFromCreds
case strings.HasPrefix(target, "unix:") || strings.HasPrefix(target, "unix-abstract:"): } else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok {
// TODO: remove when the unix resolver implements optional interface to cc.authority = auth.OverrideAuthority(cc.parsedTarget)
// return channel authority. } else if strings.HasPrefix(endpoint, ":") {
cc.authority = "localhost"
case strings.HasPrefix(endpoint, ":"):
cc.authority = "localhost" + endpoint cc.authority = "localhost" + endpoint
default: } else {
// TODO: Define an optional interface on the resolver builder to return
// the channel authority given the user's dial target. For resolvers
// which don't implement this interface, we will use the endpoint from
// "scheme://authority/endpoint" as the default authority.
// Escape the endpoint to handle use cases where the endpoint
// might not be a valid authority by default.
// For example an endpoint which has multiple paths like
// 'a/b/c', which is not a valid authority by default.
cc.authority = encodeAuthority(endpoint) cc.authority = encodeAuthority(endpoint)
} }
channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority) channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority)

View File

@ -57,7 +57,7 @@ var (
// GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo // GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo
// stored in the passed in attributes. This is set by // stored in the passed in attributes. This is set by
// credentials/xds/xds.go. // credentials/xds/xds.go.
GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *xds.HandshakeInfo GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *unsafe.Pointer
// GetServerCredentials returns the transport credentials configured on a // GetServerCredentials returns the transport credentials configured on a
// gRPC server. An xDS-enabled server needs to know what type of credentials // gRPC server. An xDS-enabled server needs to know what type of credentials
// is configured on the underlying gRPC server. This is set by server.go. // is configured on the underlying gRPC server. This is set by server.go.
@ -68,11 +68,6 @@ var (
// This is used in the 1.0 release of gcp/observability, and thus must not be // This is used in the 1.0 release of gcp/observability, and thus must not be
// deleted or changed. // deleted or changed.
CanonicalString any // func (codes.Code) string CanonicalString any // func (codes.Code) string
// DrainServerTransports initiates a graceful close of existing connections
// on a gRPC server accepted on the provided listener address. An
// xDS-enabled server invokes this method on a grpc.Server when a particular
// listener moves to "not-serving" mode.
DrainServerTransports any // func(*grpc.Server, string)
// IsRegisteredMethod returns whether the passed in method is registered as // IsRegisteredMethod returns whether the passed in method is registered as
// a method on the server. // a method on the server.
IsRegisteredMethod any // func(*grpc.Server, string) bool IsRegisteredMethod any // func(*grpc.Server, string) bool
@ -188,6 +183,19 @@ var (
ExitIdleModeForTesting any // func(*grpc.ClientConn) error ExitIdleModeForTesting any // func(*grpc.ClientConn) error
ChannelzTurnOffForTesting func() ChannelzTurnOffForTesting func()
// TriggerXDSResourceNameNotFoundForTesting triggers the resource-not-found
// error for a given resource type and name. This is usually triggered when
// the associated watch timer fires. For testing purposes, having this
// function makes events more predictable than relying on timer events.
TriggerXDSResourceNameNotFoundForTesting any // func(func(xdsresource.Type, string), string, string) error
// TriggerXDSResourceNotFoundClient invokes the testing xDS Client singleton
// to invoke resource not found for a resource type name and resource name.
TriggerXDSResourceNameNotFoundClient any // func(string, string) error
// FromOutgoingContextRaw returns the un-merged, intermediary contents of metadata.rawMD.
FromOutgoingContextRaw any // func(context.Context) (metadata.MD, [][]string, bool)
) )
// HealthChecker defines the signature of the client-side LB channel health checking function. // HealthChecker defines the signature of the client-side LB channel health checking function.

View File

@ -61,6 +61,10 @@ func (b *builder) Scheme() string {
return b.scheme return b.scheme
} }
func (b *builder) OverrideAuthority(resolver.Target) string {
return "localhost"
}
type nopResolver struct { type nopResolver struct {
} }

View File

@ -1,4 +1,4 @@
//go:build !unix //go:build !unix && !windows
/* /*
* Copyright 2023 gRPC authors. * Copyright 2023 gRPC authors.

View File

@ -0,0 +1,54 @@
//go:build windows
/*
* Copyright 2023 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package internal
import (
"net"
"syscall"
"time"
"golang.org/x/sys/windows"
)
// NetDialerWithTCPKeepalive returns a net.Dialer that enables TCP keepalives on
// the underlying connection with OS default values for keepalive parameters.
//
// TODO: Once https://github.com/golang/go/issues/62254 lands, and the
// appropriate Go version becomes less than our least supported Go version, we
// should look into using the new API to make things more straightforward.
func NetDialerWithTCPKeepalive() *net.Dialer {
return &net.Dialer{
// Setting a negative value here prevents the Go stdlib from overriding
// the values of TCP keepalive time and interval. It also prevents the
// Go stdlib from enabling TCP keepalives by default.
KeepAlive: time.Duration(-1),
// This method is called after the underlying network socket is created,
// but before dialing the socket (or calling its connect() method). The
// combination of unconditionally enabling TCP keepalives here, and
// disabling the overriding of TCP keepalive parameters by setting the
// KeepAlive field to a negative value above, results in OS defaults for
// the TCP keealive interval and time parameters.
Control: func(_, _ string, c syscall.RawConn) error {
return c.Control(func(fd uintptr) {
windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_KEEPALIVE, 1)
})
},
}
}

View File

@ -59,6 +59,8 @@ import (
// atomically. // atomically.
var clientConnectionCounter uint64 var clientConnectionCounter uint64
var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool))
// http2Client implements the ClientTransport interface with HTTP2. // http2Client implements the ClientTransport interface with HTTP2.
type http2Client struct { type http2Client struct {
lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. lastRead int64 // Keep this field 64-bit aligned. Accessed atomically.
@ -568,7 +570,7 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr)
headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)})
} }
if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok {
var k string var k string
for k, vv := range md { for k, vv := range md {
// HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set.
@ -1323,10 +1325,8 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
for streamID, stream := range t.activeStreams { for streamID, stream := range t.activeStreams {
if streamID > id && streamID <= upperLimit { if streamID > id && streamID <= upperLimit {
// The stream was unprocessed by the server. // The stream was unprocessed by the server.
if streamID > id && streamID <= upperLimit { atomic.StoreUint32(&stream.unprocessed, 1)
atomic.StoreUint32(&stream.unprocessed, 1) streamsToClose = append(streamsToClose, stream)
streamsToClose = append(streamsToClose, stream)
}
} }
} }
t.mu.Unlock() t.mu.Unlock()

View File

@ -960,7 +960,12 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
} }
} }
if err := t.writeHeaderLocked(s); err != nil { if err := t.writeHeaderLocked(s); err != nil {
return status.Convert(err).Err() switch e := err.(type) {
case ConnectionError:
return status.Error(codes.Unavailable, e.Desc)
default:
return status.Convert(err).Err()
}
} }
return nil return nil
} }

View File

@ -25,8 +25,14 @@ import (
"context" "context"
"fmt" "fmt"
"strings" "strings"
"google.golang.org/grpc/internal"
) )
func init() {
internal.FromOutgoingContextRaw = fromOutgoingContextRaw
}
// DecodeKeyValue returns k, v, nil. // DecodeKeyValue returns k, v, nil.
// //
// Deprecated: use k and v directly instead. // Deprecated: use k and v directly instead.
@ -238,16 +244,13 @@ func copyOf(v []string) []string {
return vals return vals
} }
// FromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD. // fromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD.
// //
// Remember to perform strings.ToLower on the keys, for both the returned MD (MD // Remember to perform strings.ToLower on the keys, for both the returned MD (MD
// is a map, there's no guarantee it's created using our helper functions) and // is a map, there's no guarantee it's created using our helper functions) and
// the extra kv pairs (AppendToOutgoingContext doesn't turn them into // the extra kv pairs (AppendToOutgoingContext doesn't turn them into
// lowercase). // lowercase).
// func fromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) {
// This is intended for gRPC-internal use ONLY. Users should use
// FromOutgoingContext instead.
func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) {
raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
if !ok { if !ok {
return nil, nil, false return nil, nil, false

View File

@ -314,3 +314,13 @@ type Resolver interface {
// Close closes the resolver. // Close closes the resolver.
Close() Close()
} }
// AuthorityOverrider is implemented by Builders that wish to override the
// default authority for the ClientConn.
// By default, the authority used is target.Endpoint().
type AuthorityOverrider interface {
// OverrideAuthority returns the authority to use for a ClientConn with the
// given target. The implementation must generate it without blocking,
// typically in line, and must keep it unchanged.
OverrideAuthority(Target) string
}

View File

@ -640,14 +640,18 @@ func encode(c baseCodec, msg any) ([]byte, error) {
return b, nil return b, nil
} }
// compress returns the input bytes compressed by compressor or cp. If both // compress returns the input bytes compressed by compressor or cp.
// compressors are nil, returns nil. // If both compressors are nil, or if the message has zero length, returns nil,
// indicating no compression was done.
// //
// TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. // TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor.
func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) {
if compressor == nil && cp == nil { if compressor == nil && cp == nil {
return nil, nil return nil, nil
} }
if len(in) == 0 {
return nil, nil
}
wrapErr := func(err error) error { wrapErr := func(err error) error {
return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error())
} }

View File

@ -74,9 +74,6 @@ func init() {
return srv.isRegisteredMethod(method) return srv.isRegisteredMethod(method)
} }
internal.ServerFromContext = serverFromContext internal.ServerFromContext = serverFromContext
internal.DrainServerTransports = func(srv *Server, addr string) {
srv.drainServerTransports(addr)
}
internal.AddGlobalServerOptions = func(opt ...ServerOption) { internal.AddGlobalServerOptions = func(opt ...ServerOption) {
globalServerOptions = append(globalServerOptions, opt...) globalServerOptions = append(globalServerOptions, opt...)
} }
@ -139,7 +136,8 @@ type Server struct {
quit *grpcsync.Event quit *grpcsync.Event
done *grpcsync.Event done *grpcsync.Event
channelzRemoveOnce sync.Once channelzRemoveOnce sync.Once
serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop serveWG sync.WaitGroup // counts active Serve goroutines for Stop/GracefulStop
handlersWG sync.WaitGroup // counts active method handler goroutines
channelzID *channelz.Identifier channelzID *channelz.Identifier
czData *channelzData czData *channelzData
@ -176,6 +174,7 @@ type serverOptions struct {
headerTableSize *uint32 headerTableSize *uint32
numServerWorkers uint32 numServerWorkers uint32
recvBufferPool SharedBufferPool recvBufferPool SharedBufferPool
waitForHandlers bool
} }
var defaultServerOptions = serverOptions{ var defaultServerOptions = serverOptions{
@ -573,6 +572,21 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption {
}) })
} }
// WaitForHandlers cause Stop to wait until all outstanding method handlers have
// exited before returning. If false, Stop will return as soon as all
// connections have closed, but method handlers may still be running. By
// default, Stop does not wait for method handlers to return.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release.
func WaitForHandlers(w bool) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
o.waitForHandlers = w
})
}
// RecvBufferPool returns a ServerOption that configures the server // RecvBufferPool returns a ServerOption that configures the server
// to use the provided shared buffer pool for parsing incoming messages. Depending // to use the provided shared buffer pool for parsing incoming messages. Depending
// on the application's workload, this could result in reduced memory allocation. // on the application's workload, this could result in reduced memory allocation.
@ -932,6 +946,12 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) {
return return
} }
if cc, ok := rawConn.(interface {
PassServerTransport(transport.ServerTransport)
}); ok {
cc.PassServerTransport(st)
}
if !s.addConn(lisAddr, st) { if !s.addConn(lisAddr, st) {
return return
} }
@ -941,15 +961,6 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) {
}() }()
} }
func (s *Server) drainServerTransports(addr string) {
s.mu.Lock()
conns := s.conns[addr]
for st := range conns {
st.Drain("")
}
s.mu.Unlock()
}
// newHTTP2Transport sets up a http/2 transport (using the // newHTTP2Transport sets up a http/2 transport (using the
// gRPC http2 server transport in transport/http2_server.go). // gRPC http2 server transport in transport/http2_server.go).
func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport {
@ -1010,9 +1021,11 @@ func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport,
streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams) streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams)
st.HandleStreams(ctx, func(stream *transport.Stream) { st.HandleStreams(ctx, func(stream *transport.Stream) {
s.handlersWG.Add(1)
streamQuota.acquire() streamQuota.acquire()
f := func() { f := func() {
defer streamQuota.release() defer streamQuota.release()
defer s.handlersWG.Done()
s.handleStream(st, stream) s.handleStream(st, stream)
} }
@ -1911,6 +1924,10 @@ func (s *Server) stop(graceful bool) {
s.serverWorkerChannelClose() s.serverWorkerChannelClose()
} }
if graceful || s.opts.waitForHandlers {
s.handlersWG.Wait()
}
if s.events != nil { if s.events != nil {
s.events.Finish() s.events.Finish()
s.events = nil s.events = nil

View File

@ -48,6 +48,8 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool))
// StreamHandler defines the handler called by gRPC server to complete the // StreamHandler defines the handler called by gRPC server to complete the
// execution of a streaming RPC. // execution of a streaming RPC.
// //
@ -184,7 +186,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
// when the RPC completes. // when the RPC completes.
opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...) opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...)
if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok {
// validate md // validate md
if err := imetadata.Validate(md); err != nil { if err := imetadata.Validate(md); err != nil {
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())

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.60.1" const Version = "1.61.0"

View File

@ -88,7 +88,7 @@ not git grep -l 'x/net/context' -- "*.go"
git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^interop/stress\|grpcrand\|^benchmark\|wrr_test' git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^interop/stress\|grpcrand\|^benchmark\|wrr_test'
# - Do not use "interface{}"; use "any" instead. # - Do not use "interface{}"; use "any" instead.
git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc' git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc\|grpc_testing_not_regenerate'
# - Do not call grpclog directly. Use grpclog.Component instead. # - Do not call grpclog directly. Use grpclog.Component instead.
git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go'
@ -127,7 +127,7 @@ staticcheck -go 1.19 -checks 'all' ./... > "${SC_OUT}" || true
grep -v "(ST1000)" "${SC_OUT}" | grep -v "(SA1019)" | grep -v "(ST1003)" | not grep -v "(ST1019)\|\(other import of\)" grep -v "(ST1000)" "${SC_OUT}" | grep -v "(SA1019)" | grep -v "(ST1003)" | not grep -v "(ST1019)\|\(other import of\)"
# Exclude underscore checks for generated code. # Exclude underscore checks for generated code.
grep "(ST1003)" "${SC_OUT}" | not grep -v '\(.pb.go:\)\|\(code_string_test.go:\)' grep "(ST1003)" "${SC_OUT}" | not grep -v '\(.pb.go:\)\|\(code_string_test.go:\)\|\(grpc_testing_not_regenerate\)'
# Error for duplicate imports not including grpc protos. # Error for duplicate imports not including grpc protos.
grep "(ST1019)\|\(other import of\)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused grep "(ST1019)\|\(other import of\)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused
@ -152,6 +152,7 @@ grep "(SA1019)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused
XXXXX Protobuf related deprecation errors: XXXXX Protobuf related deprecation errors:
"github.com/golang/protobuf "github.com/golang/protobuf
.pb.go: .pb.go:
grpc_testing_not_regenerate
: ptypes. : ptypes.
proto.RegisterType proto.RegisterType
XXXXX gRPC internal usage deprecation errors: XXXXX gRPC internal usage deprecation errors:
@ -184,9 +185,6 @@ GetSafeRegexMatch
GetSuffixMatch GetSuffixMatch
GetTlsCertificateCertificateProviderInstance GetTlsCertificateCertificateProviderInstance
GetValidationContextCertificateProviderInstance GetValidationContextCertificateProviderInstance
XXXXX TODO: Remove the below deprecation usages:
CloseNotifier
Roots.Subjects
XXXXX PleaseIgnoreUnused' XXXXX PleaseIgnoreUnused'
echo SUCCESS echo SUCCESS

8
vendor/modules.txt vendored
View File

@ -253,16 +253,16 @@ google.golang.org/appengine/internal/log
google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/remote_api
google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/urlfetch google.golang.org/appengine/urlfetch
# google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 # google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac
## explicit; go 1.19 ## explicit; go 1.19
google.golang.org/genproto/protobuf/field_mask google.golang.org/genproto/protobuf/field_mask
# google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 # google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457
## explicit; go 1.19 ## explicit; go 1.19
google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/api/httpbody
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac # google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac
## explicit; go 1.19 ## explicit; go 1.19
google.golang.org/genproto/googleapis/rpc/status google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.60.1 # google.golang.org/grpc v1.61.0
## explicit; go 1.19 ## explicit; go 1.19
google.golang.org/grpc google.golang.org/grpc
google.golang.org/grpc/attributes google.golang.org/grpc/attributes
@ -696,7 +696,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20240123160146-ab9b69024c39 # knative.dev/hack v0.0.0-20240123160146-ab9b69024c39
## explicit; go 1.18 ## explicit; go 1.18
knative.dev/hack knative.dev/hack
# knative.dev/pkg v0.0.0-20240129115945-d34ca0343c54 # knative.dev/pkg v0.0.0-20240129160226-b6659cc45066
## explicit; go 1.18 ## explicit; go 1.18
knative.dev/pkg/apis knative.dev/pkg/apis
knative.dev/pkg/apis/duck knative.dev/pkg/apis/duck