137 Commits

Author SHA1 Message Date
57640c0e6f Allow storing alternate transport.ServerStream implementations in context (#1904) 2018-03-20 17:02:32 -07:00
583a630396 Expunge error codes that shouldn't be returned from library (#1875)
- Per 9d0bc30edb/doc/statuscodes.md
- Relevant issue: #1672
2018-02-22 14:28:59 -08:00
0b24825eb1 Adjust keepalive paramenters in the test such that scheduling delays don't cause false failures too often. (#1730) 2017-12-15 16:03:42 -08:00
ddbb27e545 client: backoff before reconnecting if an HTTP2 server preface was not received (#1648) 2017-12-01 09:55:42 -08:00
ebefec97dd travis: fix GOARCH=386 and add misspell check (#1658)
- Define env variable RUN386 and set GOARCH later, instead of assigning to GOARCH directly. Otherwise, gimme will override GOARCH back
- Add misspell check
- Disable -race on 386
2017-11-08 13:40:05 -08:00
8ff8683602 Implement transparent retries for gRFC A6 (#1597) 2017-11-06 13:45:11 -08:00
4318e6475c server: apply deadline to new connections until all handshaking is completed (#1646) 2017-11-03 13:53:17 -07:00
ac0ac2b80e Speed-up quota pools. (#1636)
* First commit.

* First commit.

* Second commit.

* Post-review update.
2017-11-02 13:39:27 -07:00
246b2f7081 Fix settings ack race (#1630)
* First commit.

* fixed a bug

* mend

* remove debug residual

* Apply settings in the reader goroutine instead of writer.

* Post-review updates

* Post-review update.
2017-10-31 10:19:55 -07:00
e9a5821d35 Acquire all stream related quota and cache it locally since no more than one write can happen in parallel on stream (#1614)
* Acquire all the stream related quotas and cache them locally since only one write can happen on a stream at a time.

* Added new tests.

* Fix flake

* Post-review updates

* Post-review update
2017-10-26 10:04:36 -07:00
5a82377e69 transport: refactor of error/cancellation paths (#1533)
- The transport is now responsible for closing its own connection when an error
  occurs or when the context given to it in NewClientTransport() is canceled.

- Remove client/server shutdown channels -- add cancel function to allow
  self-cancellation.

- Plumb the clientConn's context into the client transport to allow for the
  transport to be canceled even after it has been removed from the ac (due to
  graceful close) when the ClientConn is closed.
2017-10-02 11:56:31 -07:00
8214c28a62 Make IO Buffer size configurable. (#1544)
* Make IO Buffer size configurable.

* Fixing typo
2017-09-28 14:11:14 -07:00
6014154b60 Use the same hpack encoder on a transport and share it between RPCs. (#1536) 2017-09-28 13:37:13 -07:00
4768575235 Fix format error on travis (#1527) 2017-09-20 09:30:13 -07:00
894322f00c Dedicated goroutine for writing. (#1498) 2017-09-14 13:44:14 -07:00
e60698345e Fix context warnings from govet. (#1486)
Pre-req work for #1484
2017-08-29 11:04:15 -07:00
fa59b779e8 Remove unnecessary function handleStreamSuspension (#1468) 2017-08-25 13:51:53 -07:00
01089b2972 Remove buf copy when the compressor exist (#1427) 2017-08-25 12:26:38 -07:00
971efedc20 Revert "Make all "grpc-" metadata field names reserved (#1391)" (#1400)
This reverts commit 3ddcdc268d88595eb2f3721f7dc87970a6c3ab6e.
2017-07-28 11:04:27 -07:00
3ddcdc268d Make all "grpc-" metadata field names reserved (#1391) 2017-07-26 10:50:56 -07:00
d69dedd8b7 BDP estimation and window update. (#1310) 2017-07-11 13:00:55 -07:00
7df48bee88 transport: fix error handling on Stream deletion (#1275)
This patch writes client-side error before closing the active stream
to fix blocking `RecvMsg` issue on `grpc.ClientStream` [1].

Previous gRPC client stream just exits on `ClientTransport.Error` [2].
And latest gRPC added another select case on client connection context
cancel [3]. Now when client stream closes from client connection context
cancel, it calls `CloseStream` with `ErrClientConnClosing` error. And then
the stream gets deleted from `*http2Client.activeStreams`, without processing
the error [4]. Then in-flight `RecvMsg` call on this client will block on
`*parser.Reader.recvMsg` [5].

In short,

1. `ClientConn.Close`.
2. in-flight streams will receive case `<-cc.ctx.Done()`
   https://github.com/grpc/grpc-go/blob/master/stream.go#L253-L255.
3. `cs.closeTransportStream(ErrClientConnClosing)` calls `cs.t.CloseStream(cs.s, err)`.
4. `CloseStream(cs.s, err)` calls `delete(t.activeStreams, s.id)`
   without handling the error.
5. in-flight streams will never receive error, left hanging.

I can reproduce in etcd tests with in-flight `recvMsg` calls to `Observe` RPC.

---
[1] https://github.com/coreos/etcd/pull/7896#issuecomment-305241742
[2] https://github.com/grpc/grpc-go/blob/v1.2.x/stream.go#L235-L238
[3] https://github.com/grpc/grpc-go/pull/1136
[4] https://github.com/grpc/grpc-go/blob/master/transport/http2_client.go#L569
[5] https://github.com/grpc/grpc-go/blob/master/rpc_util.go#L280

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-14 14:35:09 -07:00
ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00
1e47334c73 Decouple transport flow control from application read. (#1265)
* Decouple transport flow control from application read.

* post-review update

* Added comment in http2_server as well.

* Added another test

* Fixed typos in comments.
2017-06-01 09:42:07 -07:00
6dff7c5f33 Expand stream's flow control in case of an active read. (#1248)
* First commit

* Imported tests from the original PR by @apolcyn.

* Formatting fixes.

* More formating fixes

* more golint

* Make logs more informative.

* post-review update

* Added test to check flow control accounts after sending large messages.

* post-review update

* Empty commit to kickstart travis.

* Post-review update.
2017-05-23 11:39:15 -07:00
3dd14ccc71 Http status to grpc status conversion (#1195) 2017-05-11 09:40:46 -07:00
f3b5bf53ce Make window size configurable. (#1210)
* Make window size configurable.
2017-05-05 13:26:56 -07:00
b507112439 Add status package for reporting gRPC status and errors (#1156)
When an error implemented by the status package is returned from a service
handler, the server will transmit a rich status message in the
"grpc-status-details-bin" trailing metadata field if any detailed data is
attached to the error.  Client-side, we will decode them if present in the
server's response and return them to the user code performing the RPC.

This is backward compatible with the existing errors supported by the grpc
package.  However, the grpc.Errorf, grpc.Code and grpc.ErrorDesc functions for
managing errors are now deprecated; status.Errorf and status.Status type
asserions should be used instead.
2017-04-05 10:35:40 -07:00
b2fae0cf40 Implementation for server enforcement of keepalive policy. (#1147)
Implementation of server enforcement of keepalive policy.
Server will close connection with a client that violates this policy.
Policy parameters:
 - MinTime is the minimum amount of time a client should wait before sending a keepalive ping.
 - If PermitWithoutStream true, server expects keepalive pings even when there are no active streams(RPCs).
2017-03-31 11:37:51 -07:00
c3df40279c Support max age(#1119)
The new logic added to the server does the following:
- Gracefully closes an idle connection after a duration of keepalive.MaxConnectionIdle.
- Gracefully closes any connection after a duration of keepalive.MaxConnectionAge.
- Forcibly closes a connection after an additive period of keepalive.MaxConnectionAgeGrace over keepalive.MaxConnectionAge.
- Makes sure a connection is alive by sending pings with a frequency of keepalive.Time and closes a non-resposive connection after an additional duration of keepalive.Timeout.
2017-03-23 10:49:38 -07:00
d9541d7591 post-review commit. 2017-03-22 15:24:17 -07:00
9d8d0c6e0a Update test to work according to changes made to maxStreams behavior. (#1137) 2017-03-22 13:52:10 -07:00
3c9df8ef7b Post review updates 2017-03-20 15:28:47 -07:00
82fb96a360 Rest of the implementation 2017-03-10 17:30:46 -08:00
659f981255 more initial commits 2017-03-09 20:03:59 -08:00
1bf38b6a40 initial commit 2017-03-09 17:46:47 -08:00
d9b58b5ce9 Initial commit 2017-03-09 15:33:28 -08:00
5ebdd304ba lint update and test fix 2017-03-08 11:35:54 -08:00
661dbbc817 conflict resolve 2017-03-06 13:19:09 -08:00
9d23576618 post-review update 2017-03-06 13:08:23 -08:00
bc3cca9945 Implementation changes;Using an independent goroutine for keepalive checks. 2017-02-28 11:49:51 -08:00
df4f24b125 1. Initialize streamsQuota at object creation.
2. Defer adding back to streamsQuota pool in CloseStream
2017-02-13 14:24:31 -08:00
336b4ea3cf post review update 2017-02-10 16:47:43 -08:00
0bdf059601 post review updates 2017-01-31 16:09:40 -08:00
5fcb58f02d post review updates 2017-01-30 11:32:54 -08:00
49d2a88c27 Comment formatting 2017-01-06 17:18:22 -08:00
eeb6f5bade code cleaning 2017-01-06 16:52:37 -08:00
901cdf6fb5 Post review updates 2016-11-21 14:18:57 -08:00
058907d033 refactored and rectified test failures 2016-11-18 13:55:04 -08:00
e58450b5d3 Keepalive client-side implementation 2016-11-17 17:50:52 -08:00