transport: Fix deadlock in client keepalive. (#1460)

When gRPC keepalives are enabled (which isn't the case by default at
this time) and PermitWithoutStream is false (the default), the client
can deadlock when transitioning between having no active stream and
having one active stream.  Subsequent attempts to create a new stream
or to close the client will hang on the transport's mutex, while the
keepalive goroutine is waiting indefinitely on a channel while holding
the transport's mutex.

This fixes #1459.
1 file changed
tree: 0e11986a7f6a72eb48a1361cf86f59bccdb95bc8
  1. .github/
  2. benchmark/
  3. codes/
  4. connectivity/
  5. credentials/
  6. Documentation/
  7. examples/
  8. grpclb/
  9. grpclog/
  10. health/
  11. internal/
  12. interop/
  13. keepalive/
  14. metadata/
  15. naming/
  16. peer/
  17. reflection/
  18. stats/
  19. status/
  20. stress/
  21. tap/
  22. test/
  23. testdata/
  24. transport/
  25. .travis.yml
  26. AUTHORS
  27. backoff.go
  28. backoff_test.go
  29. balancer.go
  30. balancer_test.go
  31. call.go
  32. call_test.go
  33. clientconn.go
  34. clientconn_test.go
  35. codec.go
  36. codec_benchmark_test.go
  37. codec_test.go
  38. codegen.sh
  39. CONTRIBUTING.md
  40. coverage.sh
  41. doc.go
  42. go16.go
  43. go17.go
  44. grpclb.go
  45. install-protobuf.sh
  46. interceptor.go
  47. LICENSE
  48. Makefile
  49. proxy.go
  50. proxy_test.go
  51. README.md
  52. rpc_util.go
  53. rpc_util_test.go
  54. server.go
  55. server_test.go
  56. stream.go
  57. trace.go
README.md

gRPC-Go

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: 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

This requires Go 1.6 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