The Go language implementation of gRPC. HTTP/2 based RPC
jadekler internal: refactor transport to single retry mechanism (#2461)
Previously, the transport was able to reset via the retry loop,
or via the event closures calling resetTransport. This meant
a very large amount of synchronization was necessary: one
reset meant the other had to not reset; state had to be kept
at the addrconn; and very subtle interactions were hard to
reason about.

This change removes the ability for event closures to directly
reset the transport. Instead, they signal to to the retry
loop about the event, and the retry loop is always the single
place that retries occur.

This also allows us to refactor the address switching logic
into a much simpler for loop inside the retry loop instead of
using addrConn state to keep track of an index.
Latest commit 1b41b79 Dec 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add lock.yml for locking closed, stale PRs/issues (#2331) Sep 25, 2018
Documentation examples: metadata (#2500) Dec 13, 2018
balancer client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
benchmark cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
binarylog/grpc_binarylog_v1 binarylog: implement methodlogger (#2334) Oct 19, 2018
channelz cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
codes codes: fix: marshal/unmarshal a Code to JSON fails (#2116) Jun 1, 2018
connectivity cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
credentials client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
encoding Remove support for Go1.6-1.8 (#2428) Nov 1, 2018
examples examples: deadline (#2494) Dec 14, 2018
grpclog Fix "deprecated" function godoc comments to match standard formatting ( May 2, 2018
health health: shutdown server to set NOT_SERVING and disallow future updates ( Dec 10, 2018
internal internal: refactor transport to single retry mechanism (#2461) Dec 17, 2018
interop cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
keepalive comment typo: MaxConnectionAgeGrace(#2515) Dec 10, 2018
metadata cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
naming cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
peer cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
reflection client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
resolver cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
stats client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
status Remove support for Go1.6-1.8 (#2428) Nov 1, 2018
stress client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
tap cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
test health check test: prevent double close of hcEnterChan (#2441) Dec 14, 2018
testdata testdata: get test assets related to package root instead of GOPATH (#… Aug 22, 2018
.travis.yml travis: remove Go 1.6 and 1.8 tests (#2415) Nov 1, 2018
AUTHORS add AUTHORS and LICENSE Jun 8, 2017
CONTRIBUTING.md documentation: add instructions for running tests locally (#2006) Apr 20, 2018
LICENSE Make Apache 2.0 LICENSE file a verbatim copy (#1329) Jun 21, 2017
Makefile Transport refactor (#2305) Sep 20, 2018
README.md Remove support for Go1.6-1.8 (#2428) Nov 1, 2018
backoff.go internal: move backoff to internal (#2141) Jun 13, 2018
balancer.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
balancer_conn_wrappers.go grpclb: filter out grpclb addresses if balancer in use is not grpclb (#… Dec 13, 2018
balancer_switching_test.go grpclb: filter out grpclb addresses if balancer in use is not grpclb (#… Dec 13, 2018
balancer_test.go client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
balancer_v1_wrapper.go plumb lastConn error in v1 balancer (#2508) Dec 7, 2018
call.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
call_test.go client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
clientconn.go internal: refactor transport to single retry mechanism (#2461) Dec 17, 2018
clientconn_state_transition_test.go internal: refactor transport to single retry mechanism (#2461) Dec 17, 2018
clientconn_test.go internal: refactor transport to single retry mechanism (#2461) Dec 17, 2018
codec.go encoding: Introduce new method for registering and choosing codecs (#… Jan 23, 2018
codec_test.go encoding: Introduce new method for registering and choosing codecs (#… Jan 23, 2018
codegen.sh FIX: use /usr/bin/env bash in shebang Dec 17, 2016
dialoptions.go health check test: prevent double close of hcEnterChan (#2441) Dec 14, 2018
doc.go Fix missing and wrong license (#1422) Aug 4, 2017
go.mod internal: update golint to use new url (#2393) Oct 31, 2018
go.sum internal: update golint to use new url (#2393) Oct 31, 2018
install_gae.sh testing: upgrade appengine sdk to version 1.9.68 (#2311) Sep 18, 2018
interceptor.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
picker_wrapper.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
picker_wrapper_test.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
pickfirst.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
pickfirst_test.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
proxy.go proxy: support basic authentication (#2426) Nov 13, 2018
proxy_test.go proxy: support basic authentication (#2426) Nov 13, 2018
resolver_conn_wrapper.go resolverWrapper: remove the watcher goroutine (#2446) Nov 9, 2018
resolver_conn_wrapper_test.go tests: fix leak in TestDialParseTargetUnknownScheme (#2320) Sep 27, 2018
rpc_util.go client: deprecates FailFast & replaces its use by WaitForReady. Dec 13, 2018
rpc_util_test.go transport: eliminate StreamError; use status errors instead (#2239) Jul 26, 2018
server.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
server_test.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
service_config.go health: Client LB channel health checking (#2387) Nov 1, 2018
service_config_test.go Change parseTimeout to not handle non-second durations (#1706) Dec 5, 2017
stream.go cleanup: replace "x/net/context" import with "context" (#2439) Nov 12, 2018
trace.go Truncate payload trace string, and turn trace off by default (#1509) Sep 8, 2017
version.go Change version to 1.18.0-dev (#2498) Dec 5, 2018
vet.sh health check test: prevent double close of hcEnterChan (#2441) Dec 14, 2018

README.md

gRPC-Go

Build Status GoDoc GoReportCard

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: Go guide.

Installation

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 -u google.golang.org/grpc

Prerequisites

gRPC-Go requires Go 1.9 or later.

Constraints

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.

Documentation

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

Performance

See the current benchmarks for some of the languages supported in this dashboard.

Status

General Availability Google Cloud Platform Launch Stages.

FAQ

Compiling error, undefined: grpc.SupportPackageIsVersion

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

  • go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
  • go get -u google.golang.org/grpc
  • protoc --go_out=plugins=grpc:. *.proto

How to turn on logging

The default logger is controlled by the environment variables. Turn everything on by setting:

GRPC_GO_LOG_VERBOSITY_LEVEL=99 GRPC_GO_LOG_SEVERITY_LEVEL=info

The RPC failed with error "code = Unavailable desc = transport is closing"

This error means the connection the RPC is using was closed, and there are many possible reasons, including:

  1. mis-configured transport credentials, connection failed on handshaking
  2. bytes disrupted, possibly by a proxy in between
  3. server shutdown

It can be tricky to debug this because the error happens on the client side but the root cause of the connection being closed is on the server side. Turn on logging on both client and server, and see if there are any transport errors.