Commit Graph

419 Commits

Author SHA1 Message Date
Jack Li 059280c96e Set peer before sending request (#1423) 2017-08-07 10:39:34 -07:00
Menghan Li b463cc3276 Call cancel on contexts in tests (#1412) 2017-08-02 10:43:35 -07:00
田欧 ca9e0c3458 Add testdata package and unify testdata to only one dir (#1297) 2017-07-25 10:24:45 -07:00
mmukhi a5d184a8a1 Expose ConnectivityState of a ClientConn. (#1385) 2017-07-24 15:00:53 -07:00
dfawley 2bb3182589 Fix bufconn.Close to not be blocking. (#1377) 2017-07-20 14:09:45 -07:00
dfawley 939edc09d6 Revert "Use bufconn in end2end tests." (#1381)
This reverts commit c7e2c00ed1.

There is a race between Dial and Close that causes goroutine leaks in the
end2end tests.
2017-07-19 13:57:37 -07:00
Doug Fawley c7e2c00ed1 Use bufconn in end2end tests. 2017-07-17 17:09:17 -07:00
Doug Fawley 9a71c7940b Create bufconn package for a local, buffered net.Conn and dialer/listener 2017-07-17 17:09:17 -07:00
mmukhi 8264d619d8 Ignore goroutines spanwned by log.init during leakcheck. (#1368) 2017-07-11 14:55:05 -07:00
mmukhi 37be128ebf Update leckCheck to ignore non-gRPC goroutine introduced in Go1.9 (#1351) 2017-07-10 14:58:33 -07:00
田欧 3c33c26290 add license for some proto files (#1322) 2017-06-27 09:54:34 -07:00
MakMukhi 8855ede8e3 Deflake TestServerGoAway (#1321) 2017-06-22 11:54:19 -07:00
Menghan Li 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
MakMukhi dbdb479a60 Deflake TestFlowContolLogicalRace (#1279) 2017-06-08 12:54:42 -07:00
Jan Tattermusch ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00
MakMukhi 6fecf2831a Reopening: Server shouldn't Fatalf in case it fails to encode. (#1276)
* Server shouldn't Fatalf in case it fails to encode.
2017-06-02 12:32:37 -07:00
MakMukhi 843116533a Revert "Server shouldn't Fatalf in case it fails to encode. (#1251)" (#1274)
This reverts commit d5bc85c1e9.
2017-06-01 12:34:28 -07:00
MakMukhi d5bc85c1e9 Server shouldn't Fatalf in case it fails to encode. (#1251)
* Server shouldn't Fatalf in case it fails to encode.

* golint

* post-review update
2017-06-01 11:57:45 -07:00
Menghan Li 2739967807 re-enable handler_server in end2end test, and fix some failed tests (#1259) 2017-05-26 08:26:41 -07:00
MakMukhi 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
Yuxuan Li cb64938381 fix minor issues 2017-05-19 16:02:02 -07:00
Yuxuan Li d19bbe846e change max message size functions name 2017-05-19 11:08:40 -07:00
Yuxuan Li 504db8e582 merge master 2017-05-18 14:52:35 -07:00
Tamir Duberstein 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
lyuxuan 7505481848 comments added 2017-05-15 15:13:53 -07:00
Yuxuan Li 35d77ea991 merge master, resolve conflicts 2017-05-15 13:54:22 -07:00
Yuxuan Li bdf9a640e4 add timeout test, add check or pointer filed in callOption, fix minor issues 2017-05-15 13:51:11 -07:00
Menghan Li aacd01c219 call listen with "localhost:port" instead of ":port" in tests (#1237) 2017-05-15 12:43:49 -07:00
MakMukhi 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
Yuxuan Li 59426b3c05 gofmt 2017-05-08 00:22:57 +00:00
lyuxuan 3ea287058c Merge branch 'master' into service_config_pr 2017-05-07 16:49:32 -07:00
MakMukhi f3b5bf53ce Make window size configurable. (#1210)
* Make window size configurable.
2017-05-05 13:26:56 -07:00
dfawley 68a5d50f45 Fix go buildable source file problem (#1213) 2017-05-02 15:55:05 -07:00
dfawley 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
Yuxuan Li 9c5f260e67 make max size a pointer type and initialize function a CallOption 2017-04-26 15:50:58 -07:00
Yuxuan Li bab6b617b7 merge master 2017-04-21 16:07:34 -07:00
MakMukhi 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
Yuxuan Li cb02ab4d25 change error message from InvalidArgument to ResourceExhausted 2017-04-13 16:51:56 -07:00
Yuxuan Li 8788b75675 merge master resolve conflicts 2017-04-13 16:28:15 -07:00
dfawley b47cbd158b Use proto import from google.golang.org instead of github.com (#1176) 2017-04-10 10:15:59 -07:00
dfawley 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
Yuxuan Li c6a3937033 fix send response error case 2017-04-06 14:30:59 -07:00
Yuxuan Li 6f8b55318a fix the testMaxMsgSizeServerAPI failure 2017-04-06 14:08:04 -07:00
lyuxuan f02290b023 Merge branch 'master' into service_config_pr 2017-04-05 11:15:55 -07:00
Yuxuan Li a66f9231a8 Make initial service config non-blocking in Dial() 2017-04-05 11:08:50 -07:00
dfawley 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
MakMukhi f45e6e3b30 Bug fix(Issue#1141): Check if peer is nil before trying to derefer it. (#1143) 2017-04-04 15:08:14 -07:00
Yuxuan Li ad16b942fb fix gofmt goimports go tool vet errors 2017-04-03 16:03:05 -07:00
Yuxuan Li 13b5f120b0 merge master 2017-04-03 15:20:13 -07:00
Yuxuan Li 50d4175072 Add client and service side apis for limiting the send/recv msg size. Update MethodConfig struct 2017-04-03 15:03:24 -07:00
Menghan Li b982c1caa6 Behavior change: do not strip out gRPC user-agent (#1158) 2017-04-03 12:31:31 -07:00
Mahak Mukhi 6b28425a45 Upon observing timeout on rpc context, the client should send a RST_STREAM to the server before freeing the quota for more rpcs to be created. 2017-03-13 17:09:45 -07:00
Mahak Mukhi b9b6d48985 test debug 2017-03-09 17:01:46 -08:00
Mahak Mukhi a94b0948a3 Client should have a check on maximum size of received message size. 2017-03-09 16:58:23 -08:00
Menghan Li 8b2e129857 Merge pull request #1071 from MakMukhi/issue_1060
Issue #1060 maximum number of streams on the client should be capped …
2017-03-01 14:46:18 -08:00
Mahak Mukhi 0dc1a7dd67 post review updates 2017-03-01 11:20:02 -08:00
Michal Witkowski e59576b1bb add support for user-provided UnknownStreamHandler 2017-02-27 18:07:41 +00:00
Menghan Li 3d39290839 fix go vet in end2end test 2017-02-21 17:06:08 -08:00
Mahak Mukhi df4f24b125 1. Initialize streamsQuota at object creation.
2. Defer adding back to streamsQuota pool in CloseStream
2017-02-13 14:24:31 -08:00
Mahak Mukhi 9e922bde58 Issue #1060 maximum number of streams on the client should be capped at 100 by default 2017-02-10 11:41:20 -08:00
Mahak Mukhi 09fddba2ca remove debug code 2017-02-07 16:27:27 -08:00
Mahak Mukhi 66de296a37 post review update 2017-02-07 14:46:28 -08:00
Mahak Mukhi f9065ac5d2 Added test. 2017-02-07 12:39:32 -08:00
Qi Zhao 09aecb094e Add the initial service config support (#1009)
* Add the initial service config support

* start scWatcher later

* remove timeoutCh

* address the comments

* deal with dial timeout

* defer cancel for the newly created context for correct lifetime management

* fix the defer order

* added other 2 missing cancels
2016-12-19 16:31:00 -08:00
Rhys Hiltner 417442a753 transport: fix logical race in flow control (#1005)
Remove the add and cancel methods of quotaPool. Their use is not required, and
leads to logical races when used concurrently from multiple goroutines. Rename
the reset method to add.

The typical way that a goroutine claims quota is to call the add method and
then to select on the channel returned by the acquire method. If two
goroutines are both trying to claim quota from a single quotaPool, the second
call to the add method can happen before the first attempt to read from the
channel. When that happens the second goroutine to attempt the channel read
will end up waiting for a very long time, in spite of its efforts to prepare
the channel for reading.

The quotaPool will always behave correctly when any positive quota is on the
channel rather than stored in the struct field. In the opposite case, when
positive quota is only in the struct field and not on the channel, users of
the quotaPool can fail to access available quota. Err on the side of storing
any positive quota in the channel.

This includes a reproducer for #632, which fails on many runs with this
package at v1.0.4. The frequency of the test failures depends on how stressed
the server is, since it's now effectively checking for weird interleavings of
goroutines. It passes reliably with these changes to the transport package.

The behavior described in #734 (an RPC with a streaming response hangs
unexpectedly) matches what I've seen in my programs, and what I see in the
test case added here. If it's a logical flow control bug, this change may well
fix it.

Updates #632
Updates #734
2016-11-30 17:39:40 -08:00
Menghan Li c31bccc236 add FailOnNonTempDialError to control if gRPC should fail on non-temp dial error 2016-11-15 11:14:07 -08:00
Menghan Li 947e436ef4 return non temporary connection error if dialer returns non temprary errors 2016-11-09 17:25:46 -08:00
Menghan Li eddbd11c7e Merge pull request #968 from iamqizhao/tap
Add transport tap
2016-11-07 13:38:49 -08:00
Qi Zhao 777daa17ff Merge pull request #941 from MakMukhi/mmukhi_update_server_relection
update pre-generated code and server reflection code to comply with the change to the grpc g…
2016-11-03 16:04:21 -07:00
iamqizhao b85d2b0be5 Support transport tap 2016-11-03 14:21:24 -07:00
Mahak Mukhi 883bfc7bc8 pb.go file update 2016-10-28 12:37:56 -07:00
iamqizhao 152ccd8853 remove context.WithCancel which is not needed 2016-10-25 16:53:43 -07:00
iamqizhao 4596c55b7a Use the correct error in defer call 2016-10-25 15:32:12 -07:00
Mak Mukhi 727a60e4d1 update server reflection code to comply with the change to the grpc generator 2016-10-21 18:06:55 -07:00
Menghan Li f0b3103754 Disable handler-tls in end2end tests 2016-10-20 13:38:11 -07:00
Mark Nevill bac9e1d16e Make concurrent Server.GracefulStop calls all behave equivalently. 2016-10-17 13:18:45 +01:00
Menghan Li e790079956 Add grpc.SetHeader and ServerStream.SetHeader 2016-10-11 13:58:16 -07:00
Menghan Li 1247834778 Allow multiple calls to setTrailer 2016-09-29 14:38:20 -07:00
Qi Zhao dffd7cdf63 Merge pull request #885 from menghanl/fix_sendheader_error
Make grpc.SendHeader return rpc error
2016-09-29 10:55:26 -07:00
iamqizhao b531d0156b fix the flakiness of TestStreamingRPCTimeoutServerError 2016-09-27 17:07:14 -07:00
Qi Zhao 590256047f Merge pull request #895 from menghanl/creds_clone
[API revision] Change TransportCredentials interface
2016-09-26 16:22:07 -07:00
Menghan Li 033c91440b Fix testStreamingRPCTimeoutServerError 2016-09-26 16:11:18 -07:00
Menghan Li e63e0d4095 Add Clone() and OverrideServerName() to TransportCredentials 2016-09-26 15:18:51 -07:00
Menghan Li 1c20514d29 Make grpc.SendHeader return rpc error 2016-09-09 11:36:01 -07:00
Menghan Li 52f6504dc2 Merge pull request #867 from iamqizhao/master
Support client side interceptor
2016-09-02 15:12:15 -07:00
Menghan Li 5060203263 fixes in end2end tests 2016-09-02 14:15:26 -07:00
Menghan Li 477d54e0c9 Do not send reset stream on context timeout 2016-09-02 14:15:23 -07:00
Menghan Li 5e734ab23e Avoid creating transport stream error outside of transport 2016-09-02 11:57:42 -07:00
Qi Zhao 4c8d05f3b1 Merge pull request #864 from tamird/retry-timeout
transport: robustly detect temporary errors
2016-08-26 15:02:58 -07:00
iamqizhao 61f62e0da6 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-08-26 13:51:46 -07:00
iamqizhao 1e47e17230 Support client side interceptor 2016-08-26 13:50:38 -07:00
Qi Zhao d736c1182a Merge pull request #851 from menghanl/server_cred_return_nil_conn
Add credentials ErrConnDispatch to tell gRPC to keep rawConn open
2016-08-26 11:50:23 -07:00
Menghan Li d4b6ce0cfe Merge pull request #861 from iamqizhao/master
Add an err logging to testFailFast
2016-08-26 10:33:23 -07:00
Tamir Duberstein e1b61502bc
test: remove useless local variable 2016-08-25 21:30:54 -04:00
Tamir Duberstein 4775d9da13
test: DRY 2016-08-25 21:30:54 -04:00
Tamir Duberstein 1689a9c9eb
test: output codes as strings in failure messages 2016-08-25 21:30:52 -04:00
iamqizhao 935fb215d6 fix 2016-08-25 16:30:04 -07:00
iamqizhao 42e031a928 Use fmt instead grpclog 2016-08-25 15:13:27 -07:00
iamqizhao 4c15c984f2 change to Printf 2016-08-25 15:04:02 -07:00
iamqizhao 152c95e0d8 add err logging to testFailFast 2016-08-24 16:34:37 -07:00
Menghan Li 0c58a17d6f Add credentials ErrConnDispatch 2016-08-24 16:20:57 -07:00
Menghan Li d3a6b8a57f Add TestNonFailFastRPCSucceedOnTimeoutCreds 2016-08-24 15:38:04 -07:00
Tamir Duberstein abe69848df
travis: update all the tools
Fix new golint complaints
2016-08-18 16:53:48 -04:00
Menghan Li 35896af9ad Merge pull request #768 from menghanl/fatal_on_bad_certificates
Return error on bad certificates
2016-08-02 21:27:28 -07:00
Menghan Li 63e2ba4fce Temporarily disable handler-tls for TestClientStreamingError due to #619 2016-08-01 16:52:41 -07:00
Menghan Li f6b46c1787 Fix errors after rebasing 2016-08-01 16:01:10 -07:00
Menghan Li 4bbb9d8142 Add test env for no-balancer 2016-08-01 15:55:08 -07:00
Menghan Li 1a571b746a Add TestFailFastRPCWithNoBalancerErrorOnBadCertificates TestNonFailFastRPCWithNoBalancerErrorOnBadCertificates 2016-08-01 15:55:08 -07:00
Menghan Li 7c6eabc607 Make Dial() return original error 2016-08-01 15:55:08 -07:00
Menghan Li b41c9e8e14 Add TestFailFastRPCErrorOnBadCertificates 2016-08-01 15:55:08 -07:00
Menghan Li 779083c633 Change TestDialWithBlockErrorOnBadCertificates error check 2016-08-01 15:55:08 -07:00
Menghan Li e9e6ae6215 Make Dial() withblock error on bad certificates 2016-08-01 15:55:08 -07:00
Tamir Duberstein 5a423e610f
test: fix log noise 2016-08-01 16:28:14 -04:00
iamqizhao 21c5a43e47 fix a race condition causing http2Client.controller leaking 2016-08-01 11:51:20 -07:00
iamqizhao 058603d782 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-30 11:40:40 -07:00
iamqizhao 2f16a90cc7 tune a end2end test 2016-07-30 11:18:58 -07:00
iamqizhao fc500c24f6 fix go vet error 2016-07-29 18:08:00 -07:00
iamqizhao a4c08780d5 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-29 10:10:58 -07:00
Tamir Duberstein 069ed42115
Fix deadlock when GracefulStop()ing multiple times
Fixes #793.
2016-07-29 12:26:26 -04:00
iamqizhao 5876dcba5e a minor fix 2016-07-28 18:57:53 -07:00
Menghan Li f255f72742 Merge pull request #784 from iamqizhao/race-fix
Fix a couple of races when goaway lives with connection shutdown.
2016-07-28 15:40:27 -07:00
Tamir Duberstein 096e703537
WithDialer doesn't support cancellation
This maintains cancellation for the default dialer, but external users
will have to opt in via a future API.
2016-07-28 17:00:23 -04:00
iamqizhao b128e7465a merge the conflict 2016-07-28 13:17:23 -07:00
iamqizhao c3a89f91a6 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-28 13:04:50 -07:00
Qi Zhao 38383692ba Merge pull request #778 from tamird/golint-govet
*: enforce various linters
2016-07-28 11:22:02 -07:00
iamqizhao cd4ca4d808 Tune transport Monitor, modify the test and add more comments 2016-07-28 11:07:42 -07:00
Tamir Duberstein 220b464e81
*: golint 2016-07-27 23:38:59 -04:00
iamqizhao 63fcabeec5 some polish 2016-07-27 17:41:43 -07:00
iamqizhao 110450d45e fix races introduce by goaway 2016-07-27 17:27:10 -07:00
Tamir Duberstein 61f3f61ef0
cancel outgoing net.Dial when ClientConn is closed 2016-07-27 17:34:40 -04:00
Tamir Duberstein 2342e38669
test,transport: simplify 2016-07-27 17:20:55 -04:00
iamqizhao 8c908a8c1d Reject over-sized requests on server 2016-07-26 16:44:49 -07:00
iamqizhao b12fa98959 small touchup 2016-07-25 17:41:47 -07:00
iamqizhao f1e4d3b180 allow multiple GoAways and retrying on illegal streams 2016-07-25 16:35:32 -07:00
iamqizhao 046e606dc5 clean up 2016-07-21 18:12:01 -07:00
iamqizhao 9ad4c58355 Make it work for streaming 2016-07-21 16:19:34 -07:00
iamqizhao 873cc272c2 support goaway 2016-07-20 18:48:49 -07:00
iamqizhao 1ea428008b add the missing close(s.done) 2016-07-15 16:55:51 -07:00
iamqizhao ec7eacfcc4 some fix 2016-07-15 11:02:03 -07:00
iamqizhao 7b7cb1ae8c fix bugs and flaky tests 2016-07-14 17:12:11 -07:00
iamqizhao 48068bbe62 remove debugging info 2016-07-13 18:13:28 -07:00
iamqizhao 6205cb25ab fix some bugs 2016-07-13 18:05:02 -07:00
iamqizhao f53faa647d minor fix 2016-07-12 19:26:12 -07:00
iamqizhao 2e7aa9a2b1 Error out the send call for a client streaming rpc if the server has returned an error. 2016-07-12 19:24:33 -07:00
Menghan Li 1b5902d709 Fix review comments 2016-07-08 14:15:16 -07:00
Daniel Ruehle 562a45da66 add test to verify that errors defined with same code and description are not considered equal via the error interface 2016-07-08 10:28:36 -07:00
Daniel Ruehle d2125eeb91 fix error comparison 2016-07-08 10:28:36 -07:00
Daniel Ruehle 55fbdb44ea compare error strings, not interfaces 2016-07-08 10:28:36 -07:00
iamqizhao 605ce23104 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-06-30 15:11:56 -07:00
iamqizhao c477cb3b14 fix the flaky test 2016-06-30 14:26:31 -07:00