No description, website, or topics provided.
Go Protocol Buffer Other
rhysh and iamqizhao transport: fix logical race in flow control (#1005)
Remove the add and cancel methods of quotaPool. Their use is not required, and
leads to logical races when used concurrently from multiple goroutines. Rename
the reset method to add.

The typical way that a goroutine claims quota is to call the add method and
then to select on the channel returned by the acquire method. If two
goroutines are both trying to claim quota from a single quotaPool, the second
call to the add method can happen before the first attempt to read from the
channel. When that happens the second goroutine to attempt the channel read
will end up waiting for a very long time, in spite of its efforts to prepare
the channel for reading.

The quotaPool will always behave correctly when any positive quota is on the
channel rather than stored in the struct field. In the opposite case, when
positive quota is only in the struct field and not on the channel, users of
the quotaPool can fail to access available quota. Err on the side of storing
any positive quota in the channel.

This includes a reproducer for #632, which fails on many runs with this
package at v1.0.4. The frequency of the test failures depends on how stressed
the server is, since it's now effectively checking for weird interleavings of
goroutines. It passes reliably with these changes to the transport package.

The behavior described in #734 (an RPC with a streaming response hangs
unexpectedly) matches what I've seen in my programs, and what I see in the
test case added here. If it's a logical flow control bug, this change may well
fix it.

Updates #632
Updates #734
Latest commit 417442a Dec 1, 2016
Failed to load latest commit information.
Documentation Merge pull request #937 from menghanl/reflection_tutorial Nov 30, 2016
benchmark pb.go file update Oct 28, 2016
codes Run stringer on codes.Code Mar 24, 2015
credentials Fix a spelling mistake. Nov 1, 2016
examples Merge pull request #937 from menghanl/reflection_tutorial Nov 30, 2016
grpclb Grpclb: Support server list expiration (#962) Nov 16, 2016
grpclog Use InfoDepth/FatalDepth in glogger.go Nov 29, 2016
health pb.go file update Oct 28, 2016
internal Remove test-only methods from grpc package. Feb 25, 2016
interop fix the flakiness of timeout_on_sleeping_server interop test Nov 23, 2016
metadata add more comments to metadata Fromcontext (#986) Nov 17, 2016
naming Fix some small comments May 26, 2016
peer test peer addr Jan 7, 2016
reflection fix golint Nov 15, 2016
stats add stats tagger APIs and connection stats. (#992) Dec 1, 2016
stress Add logging of new flags Nov 29, 2016
tap Support transport tap Nov 3, 2016
test transport: fix logical race in flow control (#1005) Dec 1, 2016
testdata Updating the test SSL certs. Nov 11, 2015
transport transport: fix logical race in flow control (#1005) Dec 1, 2016
.travis.yml Skip golint in go 1.5 Oct 7, 2016 Add instructions to Mar 24, 2016
LICENSE grpc-go initial commit Feb 6, 2015
Makefile Add comment for proto in Makefile Jun 9, 2016
PATENTS Fix remaining instances of gRPC spelling. Jun 3, 2016 add note in readme pre-req section to get the latest go version Nov 10, 2016
backoff.go Removed the unused named return parameter of `BackoffConfig`'s `backo… Oct 10, 2016
backoff_test.go Revert "added two new testcases for backoff.go" Aug 9, 2016
balancer.go grpclb: Support DropRequest Oct 19, 2016
balancer_test.go Add TestOneConnectionRemoval Aug 16, 2016
call.go add stats tagger APIs and connection stats. (#992) Dec 1, 2016
call_test.go fix wrong context when handling stats Nov 9, 2016
clientconn.go add FailOnNonTempDialError to control if gRPC should fail on non-temp… Nov 15, 2016
clientconn_test.go fix a circular dependency in clientconn_test Nov 18, 2016 Update Jun 24, 2015 Allow HTML output for test coverage Dec 18, 2015
doc.go fix the grpc website url Feb 19, 2016
interceptor.go Support client side interceptor Aug 26, 2016
rpc_util.go move inPayload.RecvTime to after unmarshal Nov 8, 2016
rpc_util_test.go Add package stats, and export stats on server side. Nov 7, 2016
server.go add stats tagger APIs and connection stats. (#992) Dec 1, 2016
server_test.go *: go vet Jul 28, 2016
stream.go add stats tagger APIs and connection stats. (#992) Dec 1, 2016
trace.go Fix golint errors Jun 1, 2016


Build Status GoDoc

The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the gRPC Quick Start guide.


To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run:

$ go get


This requires Go 1.5 or later.

A note on the version used: significant performance improvements in benchmarks of grpc-go have been seen by upgrading the go version from 1.5 to the latest 1.7.1.

From, one way to install the latest version of go is:

$ GO_VERSION=1.7.1
$ OS=linux
$ ARCH=amd64
$ curl -O${GO_VERSION}.${OS}-${ARCH}.tar.gz
$ sudo tar -C /usr/local -xzf go$GO_VERSION.$OS-$ARCH.tar.gz
$ # Put go on the PATH, keep the usual installation dir
$ sudo ln -s /usr/local/go/bin/go /usr/bin/go
$ rm go$GO_VERSION.$OS-$ARCH.tar.gz


The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the list, you need a discussion with gRPC-Go authors and consultants.


See API documentation for package and API descriptions and find examples in the examples directory.




Compiling error, undefined: grpc.SupportPackageIsVersion

Please update proto package, gRPC package and rebuild the proto files:

  • go get -u{proto,protoc-gen-go}
  • go get -u
  • protoc --go_out=plugins=grpc:. *.proto