2064 Commits

Author SHA1 Message Date
3773797869 Travis: add staticcheck (#1019)
Also only run golint and go vet in Go 1.8, and fix some vet failures.
2017-05-15 17:05:27 -07:00
e2f22b027b Defined GA and add pointer to benchmarks (#1239) 2017-05-15 14:12:16 -07:00
aacd01c219 call listen with "localhost:port" instead of ":port" in tests (#1237) 2017-05-15 12:43:49 -07:00
135247d85c fix server panic trying to send on stream as client disconnects #1111 (#1115) 2017-05-15 12:41:55 -07:00
1c69e4cae0 Eagerly set a pointer to nil to help GC (#1232) 2017-05-12 14:06:10 -07:00
780308da60 add logs to grpclb on send and recv (#1235) 2017-05-12 14:05:32 -07:00
a0c3e72252 Add stats test for client streaming and server streaming RPCs (#1140) 2017-05-11 11:58:13 -07:00
88a73d35c9 Adding dial options for PerRPCCredentials (#1225)
* Adding dial options for PerRPCCredentials

* Added tests for PerRPCCredentials

* Post-review updates

* post-review updates
2017-05-11 11:07:38 -07:00
07bd9434fa Pass custom dialer to balancer (#1205)
* Pass custom dialer to balancer
* add test for passing custom dialer
* add grpclb package comment
2017-05-11 10:10:19 -07:00
3dd14ccc71 Http status to grpc status conversion (#1195) 2017-05-11 09:40:46 -07:00
17760cfd5b Calling handleRPC with context derived from the original (#1227)
* Calling handleRPC with different context derived from the original context
* change comment for tagRPC and stats fields
2017-05-10 17:54:49 -07:00
600406e696 Use pooled gzip.{Writer,Reader} in gzip{Compressor,Decompressor} (#1217)
This change saves a lot of memory by reusing the underlying
gzip.{Writer,Reader}, which allocates up to 1.4mb at every instanciation
according to [1]. This was fixed by adding a Reset method by to the
object at [2].

The amount of memory (and GC time) saved is pretty high, as reported by
pprof:

      flat  flat%   sum%        cum   cum%
   28.33GB 85.70% 85.70%    32.74GB 99.05%  compress/flate.NewWriter

      flat  flat%   sum%        cum   cum%
   19.39MB 16.74% 16.74%    22.07MB 19.05%  compress/flate.NewWriter

And the benchmarks:

benchmark                           old ns/op     new ns/op     delta
BenchmarkGZIPCompressor1B-4         215170        22291         -89.64%
BenchmarkGZIPCompressor1KiB-4       225971        27213         -87.96%
BenchmarkGZIPCompressor8KiB-4       246696        54785         -77.79%
BenchmarkGZIPCompressor64KiB-4      444851        286924        -35.50%
BenchmarkGZIPCompressor512KiB-4     2279043       2115863       -7.16%
BenchmarkGZIPCompressor1MiB-4       4412989       4258635       -3.50%

benchmark                           old allocs     new allocs     delta
BenchmarkGZIPCompressor1B-4         17             0              -100.00%
BenchmarkGZIPCompressor1KiB-4       17             0              -100.00%
BenchmarkGZIPCompressor8KiB-4       17             0              -100.00%
BenchmarkGZIPCompressor64KiB-4      17             0              -100.00%
BenchmarkGZIPCompressor512KiB-4     17             0              -100.00%
BenchmarkGZIPCompressor1MiB-4       17             0              -100.00%

benchmark                           old bytes     new bytes     delta
BenchmarkGZIPCompressor1B-4         813872        8             -100.00%
BenchmarkGZIPCompressor1KiB-4       813872        16            -100.00%
BenchmarkGZIPCompressor8KiB-4       813875        27            -100.00%
BenchmarkGZIPCompressor64KiB-4      813918        190           -99.98%
BenchmarkGZIPCompressor512KiB-4     814928        1871          -99.77%
BenchmarkGZIPCompressor1MiB-4       820889        9735          -98.81%

[1] https://github.com/golang/go/issues/6138
[2] db12f9d4e4

Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
2017-05-10 16:40:25 -07:00
4013f8d559 tentative fix to a flow control over-give-back bug (#1170) 2017-05-10 10:55:38 -07:00
ffa4ec7da2 Ensure that RoundRobin.Close() does not panic. (#1139) 2017-05-05 13:59:00 -07:00
2eb11e102d Log the actual error when inTapHandle fails in http2Server (#1185) 2017-05-05 13:40:31 -07:00
66a9140c20 make ServerOption panic messages more clear. (#1194)
ServerOption panics when fields that have been manually set are
subsequently set again.  The message verbiage of `X has been set` is
unclear since `has been set` without an adverb like `already` does not
correctly convey that the fields are set-once and were previously set.
At the worst, the original verbiage `X has been set` could imply that
the new value would have been acceptable but another error occurred.

We discovered this while conducting a code survey for implementing
extensible stubs and uniform inbound interception API.
2017-05-05 13:31:10 -07:00
f3b5bf53ce Make window size configurable. (#1210)
* Make window size configurable.
2017-05-05 13:26:56 -07:00
07f4e6bf4e Reset proto before unmarshalling (#1222) 2017-05-05 13:23:47 -07:00
844f573616 Merge pull request #1221 from adelez/doc_fixit
Fix doc
2017-05-04 16:41:58 -07:00
a40b8d44e0 Address the comments 2017-05-04 16:29:17 -07:00
7ddf89f9b7 Fix doc 2017-05-04 10:30:28 -07:00
68a5d50f45 Fix go buildable source file problem (#1213) 2017-05-02 15:55:05 -07:00
0914b46180 don't add defer func if stats handler is nil (#1214) 2017-05-02 10:16:45 -07:00
0eb507a2ca Change version to 1.4.0-dev (#1212) 2017-04-28 15:32:14 -07:00
84cd50a2f3 Fix nil pointer dereferences from status.FromProto(nil) (#1211) 2017-04-28 14:28:53 -07:00
fc5d355228 Split grpclb client load report test to deflake test. (#1206) 2017-04-28 12:06:45 -07:00
4d1604cc04 Use unpadded base64 encoding for binary metadata headers; handle padded or unpadded input (#1209) 2017-04-28 11:32:27 -07:00
b610ffd3f8 Never encode binary metadata within the metadata map (#1188)
This change ensures consistency for the user when accessing metadata values:
they are never encoded except when sent on the wire.  Previously, they would
appear encoded to client code, but not to server code.  As such, this
represents a behavior change, but one unlikely to affect user code, as it's
unusual to inspect the metadata after setting it.
2017-04-28 10:56:58 -07:00
277e90a432 Client load report for grpclb. (#1200) 2017-04-27 10:43:38 -07:00
a7fee9febf Use proto.Equal for equalities on Go proto messages (#1204) 2017-04-27 10:19:45 -07:00
c73e0165df Update grpclb proto and move grpclb into package grpc (#1186) 2017-04-25 10:51:43 -07:00
38df39bad1 Revert "temporary disable 1.6 on travis (#1198)" (#1199)
This reverts commit 72b617aacebed7836e806925e6f61eef55cb40c8.
2017-04-24 11:16:03 -07:00
72b617aace temporary disable 1.6 on travis (#1198) 2017-04-21 16:18:50 -07:00
ef10a566fe Revert "To adhere with protocol the server should send RST_STREAM on observing timeout on a strea, (#1130)"
This reverts commit 6d0e6b04b3cd553e2007ef075fd2445a192e4c0d.
2017-04-21 15:55:12 -07:00
2d949be2fe Make sure all in-flight streams close when ClientConn.Close() is called. (#1136)
* Make sure all in-flight streams close when ClientConn.Close() is called.

* added test
2017-04-21 15:03:04 -07:00
6d0e6b04b3 To adhere with protocol the server should send RST_STREAM on observing timeout on a strea, (#1130) 2017-04-21 15:02:51 -07:00
6914ab1e33 Fix broken Markdown headings in examples/gotutorial.md (#1189) 2017-04-18 10:54:52 -07:00
955c867061 Support proxy with dialer (#1098)
With this change, the default dialer checks environment variables to see if proxy is needed. If so, it dials to the proxy and does an HTTP CONNECT handshake.
2017-04-17 16:08:50 -07:00
8a6eb0f6e9 grpclb should connect to the second balancer (#1181)
grpclb needs to connect the second resolved balancer address when the first balancer disconnects.
If grpclb gets 2 resolved addresses: balancer1 and balancer2. When balancer1 disconnects, grpclb should automatically start to use balancer2.
2017-04-13 13:41:35 -07:00
0e8b58d22f use proto.Buffer API for protobuf codec and cache proto.Buffer structs (#1010)
* use a global sharded pool of proto.Buffer caches in protoCodec

* fix goimports

* make global buffer pool index counter atomic

* hack to remove alloc in encode_len_struct

* remove extra slice alloc in proto codec marshal

* replce magic number for proto size field length with constant

* replace custom cache with sync.Pool

* remove 1 line functions in codec.go and add protoCodec microbenchmarks

* add concurrent usage test for protoCodec

* fix golint.gofmt,goimport checks

* fix issues in codec.go and codec_test.go

* use go parallel benchmark helpers

* replace proto.Codec with a guess of size needed

* update Fatalf -> Errorf in tests

* wrap proto.Buffer along with cached last size into larger struct for pool use

* make wrapped proto buffer only a literal

* fix style and imports

* move b.Run into inner function

* reverse micro benchmark op order to unmarshal-marshal and fix benchmark setup-in-test bug

* add test for large message

* remove use of defer in codec.marshal

* revert recent changes to codec bencmarks

* move sub-benchmarks into >= go-1.7 only file

* add commentfor marshaler and tweak benchmark subtests for easier usage

* move build tag for go1.7 on benchmarks to inside file

* move build tag to top of file

* comment Codec, embed proto.Buffer into cached struct and add an int32 cap
2017-04-12 20:35:59 -07:00
cd8432ec07 Move handling stats.End to clientStream.finish() (#1182)
* move handling stats.End to clientStream.finish()
* add stats test for streaming RPC not calling last recv()
2017-04-12 11:55:54 -07:00
6d158dbf32 Fix markdown in README.md (#1180)
Title was not being formatted correctly.
2017-04-11 23:39:30 -07:00
ff17eeb5f6 opt in to frame reuse on the framer to reduce garbage (#1096) 2017-04-10 15:44:10 -07:00
bfa5dd27dc Client should update keepalive parameters upon receiving GoAway with … (#1169)
* Client should update keepalive parameters upon receiving GoAway with EnhanceYourCalm and debug data of too_many_pings.
2017-04-10 14:33:51 -07:00
b47cbd158b Use proto import from google.golang.org instead of github.com (#1176) 2017-04-10 10:15:59 -07:00
9090ef91c3 Merge pull request #1173 from lyuxuan/fix_status_return
add error handling for InvalidArgument error from sendResponse()
2017-04-07 16:26:28 -07:00
0c1d39df28 Separate incoming and outgoing metadata in context
This will prevent the incoming RPCs' metadata from appearing in outgoing RPCs
unless it is explicitly copied, e.g.:

incomingMD, ok := metadata.FromContext(ctx)
if ok {
  ctx = metadata.NewContext(ctx, incomingMD)
}

Fixes #1148
2017-04-07 11:54:56 -07:00
087f3d6e02 transport: implement GoString on Stream (#1167)
So context.String() won't  race when printing %#v.

It is not thread-safe to call context.String() on any context with a
stream value since valueCtx will use %#v to access all of the Stream
fields without holding a lock. Instead, print the Stream's pointer and
method for its GoString.
2017-04-07 11:16:52 -07:00
74a632af0e fix comments 2017-04-06 17:28:41 -07:00
aad28b3c55 add error handling for InvalidArgument error from sendResponse() 2017-04-06 14:40:53 -07:00