2179 Commits

Author SHA1 Message Date
3ddcdc268d Make all "grpc-" metadata field names reserved (#1391) 2017-07-26 10:50:56 -07:00
0c390d8eea remove defer funtion in recvBufferReader Read method (#1031) 2017-07-26 09:04:10 -07:00
ca9e0c3458 Add testdata package and unify testdata to only one dir (#1297) 2017-07-25 10:24:45 -07:00
a56843968d DNS resolver (#1300)
* initial dns resolver impl

* add srv lookup

* more srv

* change from string to Update

* added port handling

* a complete draft for dns resovler except the polling mechanism

* added sleep to infrequently poll the DNS server

* commented out test case since they are not portable

* remove duplicate declaration/definition in grpclb

* change namespace for grpclb structures

* goimports gofmt

* fix sorting issue

* implement sort.Interface

* different sort implementation for different go version

* add missing files

* fix missing comments

* handle err

* fix comments: unexport dnsResolver and dnsWatcher, add chan to exit Next(), add freq to control polling frequency

* enhance target string handling, add static IPWatcher, add mock test

* debug travis

* disable real address resolver test, since travis return 3 resolved IPs, 2 of them are duplicates

* shorten test time by reduce sleep time in TestIPWatcher, since it doesn't really do the DNS round trip

* resolve data race

* resolve data race using waitgroup

* reimplement setHostPort, compileUpdate, unexport ipWatcher

* delete sort related stuff, fix close bug for Next(), fix compileUpdate bug(change to map[Update]bool, plus fix minor review comments

* fix minor test case

* minor change to Next()

* use net.DefaultResolver with context as input

* add different build rules for lookupHost and lookupSRV

* minor fix

* go1.6 shall fail, but 1.7, 1.8 should pass

* go1.6 is expected to pass

* all go version should pass, added pre17 and 17 for replaceNetFunc to handle context problem

* rename test helper file name. should fix build problem

* goimports

* fix 1.7 context problem

* reformat dns_resolver_test structures

* change Next() behavior to have equal stalling interval between each lookup. Restructure dns_resolver_test.

* gofmt

* update go17_test.go, go18_test.go to reuse code. dns_resolver_test: check result and behavior correctness separately.

* update Next() logic
2017-07-24 17:17:45 -07:00
a5d184a8a1 Expose ConnectivityState of a ClientConn. (#1385) 2017-07-24 15:00:53 -07:00
cdc12d4a3c status: Add WithDetails and Details functions (#1358) 2017-07-24 14:42:24 -07:00
6495e8dfeb benchmark: remove multi-layer for loop (#1339) 2017-07-21 13:39:06 -07:00
0c41876308 transport: fix minor typo in http2_server.go (#1383)
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-21 10:58:12 -07:00
b34c88b087 Add doc in default implementation fatal functions on os.Exit() (#1365) 2017-07-21 09:39:31 -07:00
2bb3182589 Fix bufconn.Close to not be blocking. (#1377) 2017-07-20 14:09:45 -07:00
98eab9baf6 Do not create new addrConn when connection error happens (#1369) 2017-07-20 13:22:59 -07:00
2b21bfb96b Change version to 1.6.x (#1382) 2017-07-20 13:19:54 -07:00
939edc09d6 Revert "Use bufconn in end2end tests." (#1381)
This reverts commit c7e2c00ed1df1690ec11b9984b3fa8da1bfafbdd.

There is a race between Dial and Close that causes goroutine leaks in the
end2end tests.
2017-07-19 13:57:37 -07:00
71260d2171 Fix logging method (#1375) 2017-07-18 10:25:36 -07:00
c7e2c00ed1 Use bufconn in end2end tests. 2017-07-17 17:09:17 -07:00
9a71c7940b Create bufconn package for a local, buffered net.Conn and dialer/listener 2017-07-17 17:09:17 -07:00
ce03e9cc71 Fix a typo in examples/gotutorial.md (#1374) 2017-07-17 10:25:45 -07:00
d6723916d2 Use log severity and verbosity level (#1340)
- All logs use 1 severity level instead of printf
 - All transport logs only go to verbose level 2+
 - The default logger only log errors and verbosity level 1
 - Add environment variable GRPC_GO_LOG_SEVERITY_LEVEL and GRPC_GO_LOG_VERBOSITY_LEVEL to set severity or verbosity levels for the default logger
2017-07-13 12:10:19 -07:00
27b2052c95 fix deadlock of roundrobin balancer (#1353) 2017-07-12 10:15:13 -07:00
8264d619d8 Ignore goroutines spanwned by log.init during leakcheck. (#1368) 2017-07-11 14:55:05 -07:00
86ec6baad9 Populate callInfo.peer object for streaming RPCs (#1356) 2017-07-11 13:56:13 -07:00
d69dedd8b7 BDP estimation and window update. (#1310) 2017-07-11 13:00:55 -07:00
93166a0b0b Canonicalize https://grpc.io as the preferred URL prefix 2017-07-10 16:28:39 -07:00
37be128ebf Update leckCheck to ignore non-gRPC goroutine introduced in Go1.9 (#1351) 2017-07-10 14:58:33 -07:00
41d9b6ea2a Do not flush NewStream header on client side for unary RPCs and streaming RPCs with requests. (#1343)
If it's not client streaming, we should already have the request to be sent,
so we don't flush the header.
If it's client streaming, the user may never send a request or send it any
time soon, so we ask the transport to flush the header.

And flush header even without metadata
2017-07-05 16:51:14 -07:00
0100e4262c adjust import order (#1311) 2017-07-05 09:03:39 -07:00
3c33c26290 add license for some proto files (#1322) 2017-06-27 09:54:34 -07:00
9cb02b885b latency: sleep in Write when BDP is exceeded to avoid buffer bloat (#1330) 2017-06-26 16:20:44 -07:00
77d4a9f456 Add documentation to deprecate WithTimeout dial option (#1333) 2017-06-26 15:18:57 -07:00
eb7b130505 change objects in recvBuffer queue from interface to concrete type to reduce allocs (#1029) 2017-06-26 15:04:42 -07:00
57ff3285cf Catch invalid use of Server.RegisterService after Register.Serve (#828) 2017-06-26 10:39:47 -07:00
f0c566b827 benchmark: add latency/MTU/bandwidth into testcases (#1304) 2017-06-23 14:22:51 -07:00
2f3320d9d6 Updated documentation of ClientStream. (#1320) 2017-06-23 13:57:58 -07:00
1d797552ae Add support for grpc.SupportPackageIsVersion3 back (#1331)
* Support byte slice file descriptor as metadata and add SupportPackageIsVersion3 back

* add v3 test, generate testv3.pb.go with old codegen
2017-06-22 13:56:59 -07:00
8855ede8e3 Deflake TestServerGoAway (#1321) 2017-06-22 11:54:19 -07:00
79fc236e5f dont create new reader in recvMsg (#940) 2017-06-22 10:37:15 -07:00
306d7d084b Make Apache 2.0 LICENSE file a verbatim copy (#1329) 2017-06-21 10:20:47 -07:00
40e7a759a0 Protect bytesSent and bytesReceived with mutex to avoid datarace (#1318) 2017-06-19 13:57:38 -07:00
2887f9478e Add Severity and VerboseLevel to grpclog. (#922)
* Add Severity and VerboseLevel to grpclog.

* keep old interface and add loggerv2

* export NewLoggerv2
2017-06-19 13:57:04 -07:00
ea14354640 update LICENSE (#1312) 2017-06-19 10:16:33 -07:00
c5c761dbca fix spell (#1314) 2017-06-16 09:59:37 -07:00
c6b9664180 Add goroutine safety doc on stream (#1313) 2017-06-15 15:24:17 -07:00
834dbd54e0 replace 127.0.0.1 with localhost for ipv6 only environment (#1306) 2017-06-14 15:03:04 -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
a3592bda22 Behaviour Change: transport errors should be coded Unavailable instead of internal. (#1307) 2017-06-14 14:21:20 -07:00
1ab4adf22d Support ipv6 addresses in grpclb (#1303)
Add square brackets to ipv6 addresses, otherwise net.Dial() and
net.SplitHostPort() will return too many colons error.
2017-06-13 13:43:09 -07:00
89caed9e62 Return header in Stream.Header() if available (#1281)
* Return header in Stream.Header() if available

Add additional nonblocking select clause that would
check if the header is available and return it if it is.

Current implementation of transport Header often
doesn't return header, but a cancel error even though
the top level context is not canceled and the rpc
is successful and a header is actually available.
It's caused by the fact that select can choose any
"ready" channel.
Retrieving headers is flaky. With this fix, headers
are consistently retrieved for successful rpcs.

* Return header both when cancel and go away
2017-06-13 11:34:50 -07:00
a94a7ac054 add license for some files (#1296) 2017-06-12 18:10:06 -07:00
20e03965ab Make RPCs non-failfast in grpclb_test. (#1302) 2017-06-12 17:54:35 -07:00
0c68d6e2f2 Specify characters allowed in metadata keys (#1299) 2017-06-12 15:05:52 -07:00