Merge pull request #9247 from thaJeztah/bump_grpc
vendor: google.golang.org/grpc v1.57.1
This commit is contained in:
commit
14c50204e1
2
go.mod
2
go.mod
@ -67,7 +67,7 @@ require (
|
|||||||
golang.org/x/sync v0.3.0
|
golang.org/x/sync v0.3.0
|
||||||
golang.org/x/sys v0.10.0
|
golang.org/x/sys v0.10.0
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e
|
||||||
google.golang.org/grpc v1.57.0
|
google.golang.org/grpc v1.57.1
|
||||||
google.golang.org/protobuf v1.31.0
|
google.golang.org/protobuf v1.31.0
|
||||||
k8s.io/api v0.26.4
|
k8s.io/api v0.26.4
|
||||||
k8s.io/apimachinery v0.26.4
|
k8s.io/apimachinery v0.26.4
|
||||||
|
4
go.sum
4
go.sum
@ -1528,8 +1528,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
|
|||||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg=
|
||||||
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
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=
|
||||||
|
@ -64,7 +64,7 @@ require (
|
|||||||
golang.org/x/text v0.11.0 // indirect
|
golang.org/x/text v0.11.0 // indirect
|
||||||
golang.org/x/tools v0.11.0 // indirect
|
golang.org/x/tools v0.11.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e // indirect
|
||||||
google.golang.org/grpc v1.57.0 // indirect
|
google.golang.org/grpc v1.57.1 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
@ -2506,8 +2506,9 @@ google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwS
|
|||||||
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
|
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
|
||||||
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
|
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
|
||||||
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
|
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
|
||||||
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
|
||||||
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
|
google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg=
|
||||||
|
google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
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/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
|
||||||
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=
|
||||||
|
11
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
11
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
@ -171,15 +171,10 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
ID: http2.SettingMaxFrameSize,
|
ID: http2.SettingMaxFrameSize,
|
||||||
Val: http2MaxFrameLen,
|
Val: http2MaxFrameLen,
|
||||||
}}
|
}}
|
||||||
// TODO(zhaoq): Have a better way to signal "no limit" because 0 is
|
if config.MaxStreams != math.MaxUint32 {
|
||||||
// permitted in the HTTP2 spec.
|
|
||||||
maxStreams := config.MaxStreams
|
|
||||||
if maxStreams == 0 {
|
|
||||||
maxStreams = math.MaxUint32
|
|
||||||
} else {
|
|
||||||
isettings = append(isettings, http2.Setting{
|
isettings = append(isettings, http2.Setting{
|
||||||
ID: http2.SettingMaxConcurrentStreams,
|
ID: http2.SettingMaxConcurrentStreams,
|
||||||
Val: maxStreams,
|
Val: config.MaxStreams,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
dynamicWindow := true
|
dynamicWindow := true
|
||||||
@ -258,7 +253,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
framer: framer,
|
framer: framer,
|
||||||
readerDone: make(chan struct{}),
|
readerDone: make(chan struct{}),
|
||||||
writerDone: make(chan struct{}),
|
writerDone: make(chan struct{}),
|
||||||
maxStreams: maxStreams,
|
maxStreams: config.MaxStreams,
|
||||||
inTapHandle: config.InTapHandle,
|
inTapHandle: config.InTapHandle,
|
||||||
fc: &trInFlow{limit: uint32(icwz)},
|
fc: &trInFlow{limit: uint32(icwz)},
|
||||||
state: reachable,
|
state: reachable,
|
||||||
|
69
vendor/google.golang.org/grpc/server.go
generated
vendored
69
vendor/google.golang.org/grpc/server.go
generated
vendored
@ -115,12 +115,6 @@ type serviceInfo struct {
|
|||||||
mdata interface{}
|
mdata interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type serverWorkerData struct {
|
|
||||||
st transport.ServerTransport
|
|
||||||
wg *sync.WaitGroup
|
|
||||||
stream *transport.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
// Server is a gRPC server to serve RPC requests.
|
// Server is a gRPC server to serve RPC requests.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
opts serverOptions
|
opts serverOptions
|
||||||
@ -145,7 +139,7 @@ type Server struct {
|
|||||||
channelzID *channelz.Identifier
|
channelzID *channelz.Identifier
|
||||||
czData *channelzData
|
czData *channelzData
|
||||||
|
|
||||||
serverWorkerChannel chan *serverWorkerData
|
serverWorkerChannel chan func()
|
||||||
}
|
}
|
||||||
|
|
||||||
type serverOptions struct {
|
type serverOptions struct {
|
||||||
@ -178,6 +172,7 @@ type serverOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var defaultServerOptions = serverOptions{
|
var defaultServerOptions = serverOptions{
|
||||||
|
maxConcurrentStreams: math.MaxUint32,
|
||||||
maxReceiveMessageSize: defaultServerMaxReceiveMessageSize,
|
maxReceiveMessageSize: defaultServerMaxReceiveMessageSize,
|
||||||
maxSendMessageSize: defaultServerMaxSendMessageSize,
|
maxSendMessageSize: defaultServerMaxSendMessageSize,
|
||||||
connectionTimeout: 120 * time.Second,
|
connectionTimeout: 120 * time.Second,
|
||||||
@ -389,6 +384,9 @@ func MaxSendMsgSize(m int) ServerOption {
|
|||||||
// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number
|
// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number
|
||||||
// of concurrent streams to each ServerTransport.
|
// of concurrent streams to each ServerTransport.
|
||||||
func MaxConcurrentStreams(n uint32) ServerOption {
|
func MaxConcurrentStreams(n uint32) ServerOption {
|
||||||
|
if n == 0 {
|
||||||
|
n = math.MaxUint32
|
||||||
|
}
|
||||||
return newFuncServerOption(func(o *serverOptions) {
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
o.maxConcurrentStreams = n
|
o.maxConcurrentStreams = n
|
||||||
})
|
})
|
||||||
@ -590,24 +588,19 @@ const serverWorkerResetThreshold = 1 << 16
|
|||||||
// [1] https://github.com/golang/go/issues/18138
|
// [1] https://github.com/golang/go/issues/18138
|
||||||
func (s *Server) serverWorker() {
|
func (s *Server) serverWorker() {
|
||||||
for completed := 0; completed < serverWorkerResetThreshold; completed++ {
|
for completed := 0; completed < serverWorkerResetThreshold; completed++ {
|
||||||
data, ok := <-s.serverWorkerChannel
|
f, ok := <-s.serverWorkerChannel
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.handleSingleStream(data)
|
f()
|
||||||
}
|
}
|
||||||
go s.serverWorker()
|
go s.serverWorker()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleSingleStream(data *serverWorkerData) {
|
|
||||||
defer data.wg.Done()
|
|
||||||
s.handleStream(data.st, data.stream, s.traceInfo(data.st, data.stream))
|
|
||||||
}
|
|
||||||
|
|
||||||
// initServerWorkers creates worker goroutines and a channel to process incoming
|
// initServerWorkers creates worker goroutines and a channel to process incoming
|
||||||
// connections to reduce the time spent overall on runtime.morestack.
|
// connections to reduce the time spent overall on runtime.morestack.
|
||||||
func (s *Server) initServerWorkers() {
|
func (s *Server) initServerWorkers() {
|
||||||
s.serverWorkerChannel = make(chan *serverWorkerData)
|
s.serverWorkerChannel = make(chan func())
|
||||||
for i := uint32(0); i < s.opts.numServerWorkers; i++ {
|
for i := uint32(0); i < s.opts.numServerWorkers; i++ {
|
||||||
go s.serverWorker()
|
go s.serverWorker()
|
||||||
}
|
}
|
||||||
@ -966,21 +959,26 @@ func (s *Server) serveStreams(st transport.ServerTransport) {
|
|||||||
defer st.Close(errors.New("finished serving streams for the server transport"))
|
defer st.Close(errors.New("finished serving streams for the server transport"))
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams)
|
||||||
st.HandleStreams(func(stream *transport.Stream) {
|
st.HandleStreams(func(stream *transport.Stream) {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
|
streamQuota.acquire()
|
||||||
|
f := func() {
|
||||||
|
defer streamQuota.release()
|
||||||
|
defer wg.Done()
|
||||||
|
s.handleStream(st, stream, s.traceInfo(st, stream))
|
||||||
|
}
|
||||||
|
|
||||||
if s.opts.numServerWorkers > 0 {
|
if s.opts.numServerWorkers > 0 {
|
||||||
data := &serverWorkerData{st: st, wg: &wg, stream: stream}
|
|
||||||
select {
|
select {
|
||||||
case s.serverWorkerChannel <- data:
|
case s.serverWorkerChannel <- f:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
// If all stream workers are busy, fallback to the default code path.
|
// If all stream workers are busy, fallback to the default code path.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
go func() {
|
go f()
|
||||||
defer wg.Done()
|
|
||||||
s.handleStream(st, stream, s.traceInfo(st, stream))
|
|
||||||
}()
|
|
||||||
}, func(ctx context.Context, method string) context.Context {
|
}, func(ctx context.Context, method string) context.Context {
|
||||||
if !EnableTracing {
|
if !EnableTracing {
|
||||||
return ctx
|
return ctx
|
||||||
@ -2075,3 +2073,32 @@ func validateSendCompressor(name, clientCompressors string) error {
|
|||||||
}
|
}
|
||||||
return fmt.Errorf("client does not support compressor %q", name)
|
return fmt.Errorf("client does not support compressor %q", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// atomicSemaphore implements a blocking, counting semaphore. acquire should be
|
||||||
|
// called synchronously; release may be called asynchronously.
|
||||||
|
type atomicSemaphore struct {
|
||||||
|
n int64 // accessed atomically
|
||||||
|
wait chan struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *atomicSemaphore) acquire() {
|
||||||
|
if atomic.AddInt64(&q.n, -1) < 0 {
|
||||||
|
// We ran out of quota. Block until a release happens.
|
||||||
|
<-q.wait
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *atomicSemaphore) release() {
|
||||||
|
// N.B. the "<= 0" check below should allow for this to work with multiple
|
||||||
|
// concurrent calls to acquire, but also note that with synchronous calls to
|
||||||
|
// acquire, as our system does, n will never be less than -1. There are
|
||||||
|
// fairness issues (queuing) to consider if this was to be generalized.
|
||||||
|
if atomic.AddInt64(&q.n, -1) <= 0 {
|
||||||
|
// An acquire was waiting on us. Unblock it.
|
||||||
|
q.wait <- struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHandlerQuota(n uint32) *atomicSemaphore {
|
||||||
|
return &atomicSemaphore{n: int64(n), wait: make(chan struct{}, 1)}
|
||||||
|
}
|
||||||
|
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.57.0"
|
const Version = "1.57.1"
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -583,7 +583,7 @@ google.golang.org/genproto/googleapis/api/httpbody
|
|||||||
google.golang.org/genproto/googleapis/rpc/code
|
google.golang.org/genproto/googleapis/rpc/code
|
||||||
google.golang.org/genproto/googleapis/rpc/errdetails
|
google.golang.org/genproto/googleapis/rpc/errdetails
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
# google.golang.org/grpc v1.57.0
|
# google.golang.org/grpc v1.57.1
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/attributes
|
google.golang.org/grpc/attributes
|
||||||
|
Loading…
Reference in New Issue
Block a user