Commit Graph

245 Commits

Author SHA1 Message Date
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
Yuxuan Li 4a7b4d033a minor fix 2017-05-19 16:38:37 -07:00
Yuxuan Li 27ae1472a3 remove some todo comments 2017-05-19 14:55:35 -07:00
Yuxuan Li d19bbe846e change max message size functions name 2017-05-19 11:08:40 -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
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
Menghan Li 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
lyuxuan 3ea287058c Merge branch 'master' into service_config_pr 2017-05-07 16:49:32 -07:00
kirk 0914b46180 don't add defer func if stats handler is nil (#1214) 2017-05-02 10:16:45 -07:00
Menghan Li 277e90a432 Client load report for grpclb. (#1200) 2017-04-27 10:43:38 -07:00
Yuxuan Li ecbc34aaca move server defaults, delete defer cancel() in stream.go 2017-04-26 17:39:57 -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 983d8372ea update the merge of client api and sc 2017-04-21 16:18:59 -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
Menghan Li 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
Yuxuan Li fa2968617c Merge branch 'master' into service_config_pr 2017-04-06 14:12:34 -07:00
Yuxuan Li 6f8b55318a fix the testMaxMsgSizeServerAPI failure 2017-04-06 14:08:04 -07:00
dfawley 1d27587e10 Change status package to deal with concrete types instead of interfaces (#1171) 2017-04-06 11:41:07 -07:00
Yuxuan Li f1bb70facf gofmt 2017-04-05 15:08:25 -07:00
lyuxuan f02290b023 Merge branch 'master' into service_config_pr 2017-04-05 11:15:55 -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
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
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 cb653e4b61 Change stats APIs (#1030)
Change stats API from one static handler to one handler per server or client.
2017-01-09 17:11: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
Menghan Li deb01f422a add stats tagger APIs and connection stats. (#992)
* add stats.tagger APIs and connection stats.

* fix comments

use ac.ctx in http2client
change name and comments
small fixes stats_tests

* add a TODO to ConnTagInfo

* rename handle to handleRPC

* modify stats comments
2016-11-30 16:25:46 -08:00
Menghan Li ff0b1db33e fix comments 2016-11-08 10:31:02 -08:00
Menghan Li 3de821b781 remote end stats in header() and SendMsg() 2016-11-07 18:30:22 -08:00
Menghan Li badd5540a4 fix comments 2016-11-07 17:55:44 -08:00
Menghan Li 5938492b60 fix comments 2016-11-07 15:16:52 -08:00
Menghan Li a4edc462a2 renaming 2016-11-07 15:16:52 -08:00
Menghan Li aa5b5c7e2a client side, use user context, and change sent time 2016-11-07 15:16:52 -08:00
Menghan Li 1d2a929ae5 add stats.Begin and stats.End 2016-11-07 15:16:52 -08:00
Menghan Li c0087b3c91 add failfast option to stats 2016-11-07 15:16:52 -08:00
Menghan Li c698588285 Renaming types and variables 2016-11-07 15:16:52 -08:00
Menghan Li e42a66c81b add client stats 2016-11-07 15:16:52 -08:00
Menghan Li 7984a9c679 change CallBack to handler, and move ctx out of Stats. 2016-11-07 15:16:52 -08:00
Menghan Li 17ee5a3637 Add package stats, and export stats on server side. 2016-11-07 15:16:52 -08: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
Menghan Li 52f6504dc2 Merge pull request #867 from iamqizhao/master
Support client side interceptor
2016-09-02 15:12:15 -07:00
Menghan Li 5e734ab23e Avoid creating transport stream error outside of transport 2016-09-02 11:57:42 -07:00
iamqizhao 1e47e17230 Support client side interceptor 2016-08-26 13:50:38 -07:00
Menghan Li c72b08a774 Change errors returned by ac.wait() 2016-08-16 16:56:16 -07:00
Menghan Li d2b50c7ca5 Allocate clientstream after getTransport 2016-08-09 13:22:02 -07:00
Menghan Li 43cdc3c81c Finish clientstream when newclientsteram returns error 2016-08-08 16:27:22 -07:00
iamqizhao a4c08780d5 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-29 10:10:58 -07:00
iamqizhao 80572b2739 fix the streaming rpc case 2016-07-28 16:45:48 -07:00
iamqizhao 8c908a8c1d Reject over-sized requests on server 2016-07-26 16:44:49 -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 0e86f69ef3 Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-19 16:29:15 -07:00
iamqizhao d2e79470cc client goaway support 2016-07-19 16:29:13 -07:00
Menghan Li d017580d29 Merge pull request #769 from iamqizhao/master
Fix an issue in #766
2016-07-19 16:19:02 -07:00
Michael McGreevy 36bd01e409 Clarify doc comment for ClientStream.Trailer by simplifying it.
Change-Id: I1ce494d753b6e48d23c4aa23b396d182f44d9c39
2016-07-19 14:20:15 +10:00
iamqizhao 8635e25ebb Specialize the io.EOF processing of server streaming 2016-07-18 14:57:52 -07:00
iamqizhao 0bfa80150a add a TODO 2016-07-15 15:43:42 -07:00
iamqizhao df0a2ae779 finish trace with the right status 2016-07-15 15:06:00 -07:00
iamqizhao c9f0b89a96 clean up underlying footprint when Stream.Done() is read 2016-07-15 14:53:49 -07:00
iamqizhao ec7eacfcc4 some fix 2016-07-15 11:02:03 -07:00
iamqizhao 0f1aeede97 do not cancel stream in http2_client.go, use done chanel instead 2016-07-14 18:38:43 -07:00
iamqizhao 7b7cb1ae8c fix bugs and flaky tests 2016-07-14 17:12:11 -07:00
Menghan Li ffdfb592e8 Fix type assertion error after rebase 2016-07-08 10:35:38 -07:00
iamqizhao be59d023f2 refactor error handling a bit 2016-06-29 15:21:44 -07:00
iamqizhao 213a20c4fe bug fix, typo fix and slight error refactoring 2016-06-28 16:08:19 -07:00
iamqizhao 3e71fb360d Support fail-fast mode and make it the default 2016-06-27 14:36:59 -07:00
joe2far 487ada6517 Fixed typos in docstrings 2016-06-07 12:01:07 +01:00
iamqizhao 0b1df3bca2 add BalancerGetOption 2016-05-24 17:19:44 -07:00
iamqizhao aa532d5baf Fix some issues and remove garbbage files 2016-05-16 15:31:00 -07:00
iamqizhao 44373898ac Merge branch 'master' of https://github.com/grpc/grpc-go 2016-05-06 15:47:17 -07:00
iamqizhao 9c2d8546bf load balancer 2016-05-06 15:47:09 -07:00
Sai Cheemalapati 27ecb91efa Fix typo 2016-04-29 14:58:02 -07:00
iamqizhao 61e92eacc3 Phase 1 to add the server interceptor 2016-04-18 16:18:34 -07:00
Xiang Li 11ef22ebfb make comment on invoke/sendmsg more clear 2016-04-01 10:47:25 -07:00
Anthony Yeh a294a45ba0 Don't treat StatusDesc() as a format string.
For example, if the error message contains "%v", then passing
StatusDesc() as the format string to Errorf() will replace "%v" with
"%!v(MISSING)".
2016-03-19 17:15:21 -07:00
Qi Zhao 89f694edb4 Merge pull request #569 from bradfitz/error_map
Fix crashes where transports returned errors unhandled by the message parser
2016-02-24 18:22:25 -08:00
Brad Fitzpatrick 110fd99e30 Fix crashes where transports returned errors unhandled by the message parser.
The http.Handler-based transport body reader was returning error types
not understood by the recvMsg parser. See #557 for some background and
examples.

Fix the http.Handler transport and add tests. I copied in a subset of
the http2 package's serverTest type, adapted slightly to work with
grpc. In the process of adding tests, I discovered that
ErrUnexpectedEOF was also not handled by the regular server
transport. Document the rules and fix that crash as well.

Unrelated stuff in this CL:

* make tests listen on localhost:0 instead of :0, to avoid Mac firewall
  pop-up dialogs.

* rename parser.s field to parser.r, to be more idiomatic that it's an
  io.Reader and not anything fancier. (it's not acting like type
  stream, even if that's the typical concrete type)

* move 5 byte temp buffer into parser, rather than allocating it for
  each new message. (drop in the bucket improvement in garbage; more
  to do later)

* rename http2RSTErrConvTab to http2ErrConvTab, per Qi's earlier
  CL. Also add the HTTP/1.1-required error mapping for completeness,
  not that it should ever arise with gRPC, also per Qi's earlier CL
  referenced in #557.
2016-02-24 15:09:17 -08:00
iamqizhao 5085c7628d Always close tracing when a stream goes wrong 2016-02-22 18:02:10 -08:00
David Symonds 10e70583f7 Fix typo. 2016-02-12 15:19:47 +11:00
iamqizhao af8888dc8d remove Compressor/DecompressorGenerator 2016-01-29 14:38:20 -08:00
iamqizhao 6d87263bd5 add test 2016-01-27 18:34:24 -08:00
iamqizhao 086f6de8a8 force flush headers frame for server streaming and bi-di streaming 2016-01-27 16:39:34 -08:00
iamqizhao 4258b32de7 Don't create buffer if compressor is nil 2016-01-25 11:47:04 -08:00
iamqizhao da3bb0c9f7 Support compression 2016-01-22 18:21:41 -08:00
iamqizhao 8e76d451dd Add missing trace finish on an uncommon code path 2016-01-14 17:01:22 -08:00
iamqizhao 7172d5c7a6 Still show trace for the client streams which failed to create 2016-01-14 14:53:07 -08:00
iamqizhao 59c74732bb Don't trace when failing to create a cleint stream 2016-01-14 14:38:45 -08:00
iamqizhao 47fc4a2936 Specialize connection error handling to avoid goroutine leaking in some cases 2016-01-14 12:24:00 -08:00
iamqizhao 7aa428f5d6 Finish trace for premature error 2015-11-30 16:41:52 -08:00
iamqizhao afca514667 Improve rpc cancellation when there is no pending I/O 2015-10-22 13:07:13 -07:00
iamqizhao 390cd42894 revise Picker API 2015-10-08 11:05:59 -07:00
iamqizhao ec8414396c bug fix: stop busy wait on new transport 2015-10-08 09:09:06 -07:00
iamqizhao 492a718373 fix comments 2015-10-05 18:02:06 -07:00
iamqizhao 9db3ca85c7 gofmt -w 2015-10-05 17:52:00 -07:00
iamqizhao bc49d12737 refactor servier side trace again 2015-10-05 17:49:53 -07:00
iamqizhao b4aa9eae10 fix methodFamily breakage 2015-10-02 15:38:37 -07:00
iamqizhao 59258581ef remove temp changes 2015-10-02 15:14:27 -07:00
iamqizhao d84ff12005 trace refactoring 2015-10-01 17:24:39 -07:00
Qi Zhao f3de7c238c Merge pull request #369 from iamqizhao/master
refactor the interaction between ClientConn and Picker
2015-09-29 10:32:02 -07:00
iamqizhao c01ea6e359 revise Picker API 2015-09-29 10:24:03 -07:00
Qi Zhao e07e93b00e Merge pull request #358 from Sajmani/work
grpc: make trace.FromContext work, and record handler status in traces
2015-09-28 23:29:59 -07:00
iamqizhao ec99a32572 redesign the API 2015-09-25 13:21:25 -07:00
Sameer Ajmani ee98c48bb4 Incorporate dsymonds' comments.
Fix another bug: cancel the Context provided to an RPC server handler
as soon as that handler returns, so that goroutines started by that
handler can detect that the handler is done and exit. Without this
fix, goroutines started by a handler will keep running, unless the
handler itself arranges to cancel the context.
2015-09-23 22:17:37 -04:00
iamqizhao 9afcd0c697 preliminary refactoring for custom naming and load balancing 2015-09-23 19:09:37 -07:00
Sameer Ajmani b6c9c5a70f grpc: record the description of the status returned by server RPC
handlers in request traces, and mark the trace as an error if the
status is not OK.

Install the trace into the Context passed to server handlers using
trace.NewContext, so that code in the server handlers can annotate the
trace using trace.FromContext.
2015-09-23 17:07:35 -04:00
iamqizhao dd992b3748 remove transportSeq 2015-09-21 18:17:49 -07:00
Sameer Ajmani 18c359f6a9 grpc: rename request trace family from "Sent" to "grpc.Sent". 2015-08-09 23:01:01 -04:00
yangzhouhan 0231ff14bc remove duplicate check 2015-07-28 18:11:22 -07:00
yangzhouhan d90cbe84e6 fix trace set error bugs 2015-07-28 17:18:35 -07:00
yangzhouhan 3616d6be54 fix trace setError 2015-07-28 15:27:46 -07:00
yangzhouhan a3dce46030 making trace as an error when error occurs and fix the format 2015-07-28 10:13:40 -07:00
yangzhouhan 845510e440 add server side tracing 2015-07-27 14:33:17 -07:00
yangzhouhan e79ac3cb4b remove duplicate nil check separate var 2015-07-24 16:36:12 -07:00
yangzhouhan be4cb2a81a relocate response log 2015-07-24 15:39:25 -07:00
yangzhouhan 6cfd2022af add a bool in payload struct 2015-07-24 11:30:14 -07:00
yangzhouhan bd20726bd8 add client streaming response trace 2015-07-23 18:14:52 -07:00
yangzhouhan 9d4ac0cac5 fix mutex problems and merge multiple servingstatus to one single test 2015-07-23 14:45:27 -07:00
yangzhouhan 0252e09f21 add response trace log for client streaming 2015-07-23 10:55:42 -07:00
David Symonds 7c8ee356b1 Include client streaming payloads in trace, and centralise trace termination logic. 2015-07-21 09:09:35 +10:00
David Symonds 671cc291d1 Use full method for trace construction.
The methodFamily func already chops up the string, and the title should be the full method string too.

This now matches the non-streaming client trace.
2015-06-24 13:22:00 +10:00
yangzhouhan 5cf38682e6 fix traceFinish 2015-06-18 17:24:50 -07:00
yangzhouhan 8f923d5911 typo 2015-06-18 11:48:27 -07:00
yangzhouhan c63dd40b2a change the completion of the trace 2015-06-18 11:45:40 -07:00
yangzhouhan 58dcee7526 add tracing for streaming rpc 2015-06-17 19:30:57 -07:00
yangzhouhan 4782e693c2 Revert "add tracing for streaming rpc"
This reverts commit 8071e421ab.
2015-06-17 19:21:04 -07:00
yangzhouhan 8071e421ab add tracing for streaming rpc 2015-06-17 19:04:54 -07:00
iamqizhao 3259049490 fix some typos and run gofmt 2015-04-17 13:50:18 -07:00
iamqizhao bec42c09aa gofmt 2015-04-01 14:05:38 -07:00
iamqizhao 9a5de0e954 make Codec configurable when creating grpc.ClientConn and grpc.Server 2015-04-01 14:02:26 -07:00
iamqizhao 8b08b2d7b2 Interface change to accommodate the support of non-protobuf data formats 2015-03-25 15:18:07 -07:00
iamqizhao fc10c7b40c Let RecvProto return nil for client stream rpc 2015-02-19 16:48:59 -08:00
iamqizhao dbe8c6ed11 Remove port when assignning to CallHdr.Host 2015-02-19 13:55:18 -08:00
Matt T. Proud a720ae6f48 Make error conveyance more idiomatic.
This commit applies two bulk changes to the grpc error reporting
mechanisms:

(1.) Error strings for errors that originate within grpc are prefixed
    with the package name for better clarity for where they originate
    since they could percolate up in the users call chains to the
    originator.

(2.) Errors that are, in fact, singletons have been converted from
    fmt.Errorf to errors.New and assigned as package-level variables.
    This bodes particularly well for enabling API customers to elect to
    handle these errors upon receipt via equality comparison.  This had
    been previous impossible with the original API.

Supplementarily, ``gofmt -w -s=true`` has been run on the repository to
cleanup residual defects, and it has detected and repaired a few.

TEST=Manual go test ./...
2015-02-19 13:17:17 +01:00
iamqizhao 634392a1c6 Remove the 2nd RecvProto in the generated code for client streaming 2015-02-18 22:18:01 -08:00
iamqizhao 24d7933267 Always CloseStream when some error happen (especailly when reading header metadata returns an error). That is the only way to remove the stream from ClientTransport.activeStreams. 2015-02-18 14:00:26 -08:00
iamqizhao fe60321708 Fix some comments 2015-02-13 16:43:51 -08:00
David Symonds 416f68f4b3 Update import paths to use the new official location of the Go gRPC package. 2015-02-09 11:46:20 +11:00
David Symonds 9e789c396b Rename top level package from "rpc" to "grpc".
Also move the nascent package doc to doc.go.
2015-02-09 11:45:33 +11:00
David Symonds e71095e0ec Move source files up one level.
The top-level directory in this repository is going to be
the main "grpc" package.
2015-02-09 11:33:38 +11:00