Commit Graph

343 Commits

Author SHA1 Message Date
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -08:00
Menghan Li 24638f5984
binarylog: call binary log in Client and Server (#2388)
Also includes:
 - Export `NewLoggerFromConfigString` so it can be also used when config string is specified in another way (e.g. command line flag)
 - Export `Logger` so user can install custom sink
 - Add temp file sink implementation
2018-10-31 10:21:20 -07:00
Menghan Li c4d3b2fa07
channelz: register sockets with meaningful refnames (#2416) 2018-10-30 16:28:48 -07:00
Menghan Li dfaadfecca
server: handleStream() cleanup (#2352) 2018-10-15 13:27:22 -07:00
Menghan Li 0361d80ffd
server: reuse function recv() in processUnary (#2351)
This change splits recv() into two functions so it can be used by processUnary.
2018-10-08 13:55:04 -07:00
Menghan Li 59dd9b3f19
test: add go 1.11 to travis and remove go 1.7 (#2278) 2018-08-27 13:31:20 -07:00
lyuxuan 07ef407d99
channelz: unexport unnecessary API on grpc entities (#2257) 2018-08-06 16:02:47 -07:00
lyuxuan f4da7eee53
channelz: use atomic instead of mutex (#2218) 2018-08-06 11:17:12 -07:00
dfawley a344a35754
internal: remove TestingUseHandlerImpl (#2253) 2018-08-03 09:35:00 -07:00
dfawley 339b6cb107
transport: eliminate StreamError; use status errors instead (#2239) 2018-07-26 10:30:58 -07:00
dfawley e193757038
internal/transport: remove some unused fields from structs (#2213)
- Flush and Authority are never read by the transport.
- Authority is used indirectly; move it to dialOptions.
- Delay is only set to false.
2018-07-13 09:56:47 -07:00
dfawley 11b582728a
transport: move to internal to make room for new, public transport API (#2212)
This is a breaking change, but the transport package was never intended for use outside of grpc.  Any current users that we are aware of are incorrect or have a preferred alternative.
2018-07-11 11:22:45 -07:00
lyuxuan 264daa2be4
Set and respect HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE (#2084) 2018-07-09 11:27:58 -07:00
mmukhi 3ec535a269
client, server: update dial/server buffer options to support a "disable" setting (#2147) 2018-06-27 11:16:33 -07:00
lyuxuan 7268ca41d3
channelz: stage 4 - add security and socket option info with appengine build tags (#2149) 2018-06-25 10:32:20 -07:00
lyuxuan b28608a9db
channelz: move APIs to internal except channelz service (#2157) 2018-06-18 17:59:08 -07:00
lyuxuan 96cefb43cf Revert " channelz: stage 4 - add security and socket option info" (#2124)
Reverts grpc/grpc-go#2098

Appengine will fail with the error below:
```
go-app-builder: Failed parsing input: parser: bad import "syscall" in google.golang.org/grpc/channelz/funcs.go from GOPATH
```

The root cause of it is in type_linux.go.
629f6bc5e5/channelz/types_linux.go (L21-L25)
2018-06-05 18:04:12 -07:00
lyuxuan c1a21e22a6
channelz: stage 4 - add security and socket option info (#2098) 2018-06-05 13:50:19 -07:00
Menghan Li d33a923190
Revert "channelz: stage 4 - add security and socket option info" (#2096)
This reverts commit 7cc2837209.

The PR breaks darwin builds

src/google.golang.org/grpc/channelz/types_unix.go:35:15: undefined: unix.TCPInfo
2018-05-22 15:31:57 -07:00
lyuxuan 7cc2837209
channelz: stage 4 - add security and socket option info (#1965) 2018-05-22 13:32:02 -07:00
dfawley 091a800143
split encode into three functions (#2058) 2018-05-11 13:47:10 -07:00
mmukhi 0bc7c3280e
Revert "Less mem (#1987)" (#2049)
This reverts commit 7a8c989507.
2018-05-03 11:37:59 -07:00
mmukhi 3592bccfd9
interop: Fix unimplemented method test (#2040)
* Don't send nil requests.

* Fix import name and get rid of condition.

* Let registered encoder deal with nil requests.

* Break encode into encode and compress.
2018-05-02 16:08:12 -07:00
Chyroc f8dbc38bdc Fix "deprecated" function godoc comments to match standard formatting (#2027) 2018-05-02 08:52:49 -07:00
mmukhi 7a8c989507
Less mem (#1987)
* Export changes to OSS.

* First commit.

* Cherry-pick.

* Documentation.

* Post review updates.
2018-04-30 09:54:33 -07:00
dfawley fc37cf1364 server: export ServerTransportStreamFromContext for unary interceptors to control headers/trailers (#2019) 2018-04-26 17:38:15 -07:00
lyuxuan 4166ea7dad
Stage 2: Channelz metric collection (#1909) 2018-04-23 11:22:25 -07:00
lyuxuan 7f73c863c0
Channelz: Entity Registration and Deletion (#1811) 2018-04-09 11:13:06 -07:00
dfawley 2eae9d0c74
server: add grpc.Method function for extracting method from context (#1961) 2018-04-02 13:08:04 -07:00
Joshua Humphries 57640c0e6f Allow storing alternate transport.ServerStream implementations in context (#1904) 2018-03-20 17:02:32 -07:00
Brian Tiger Chow 2c2d834e8e stats: add BeginTime to stats.End (#1907) 2018-03-12 09:16:36 -07:00
Jean de Klerk 9aba04495f server: Convert all non-status errors to codes.Unknown (#1881)
- convertCode utilized errors that were not allowed by the library per 9d0bc30edb/doc/statuscodes.md
- Relevant issue: #1672
2018-03-08 13:46:26 -08:00
Eric 7646b5360d transport: support stats.Handler in serverHandlerTransport (#1840) 2018-02-06 10:11:40 -08:00
dfawley 5ba054bf37
encoding: Introduce new method for registering and choosing codecs (#1813) 2018-01-23 11:39:40 -08:00
dfawley 09fc336d84
server: fix bug preventing Serve from exiting when Listener is closed (#1765) 2017-12-22 12:42:04 -08:00
dfawley 2720857d97
server: fix race between GracefulStop and new incoming connections (#1745)
New connections can race with GracefulStop such that the server will accept the connection, but then close it immediately. If a connection is accepted before GracefulStop has a chance to effectively cancel the listeners, the server should handle it to avoid client errors.
2017-12-18 15:38:51 -08:00
Daniel Nephin 4e393e0b21 grpc: fix deprecation comments to conform to standard (#1691) 2017-12-18 09:23:42 -08:00
dfawley 816fa5b06f
Add proper support for 'identity' encoding type (#1664) 2017-11-17 09:24:54 -08:00
Elliot Wright 5f2e2f999e Corrected documentation on Server.Serve (#1668) 2017-11-13 13:37:12 -08:00
dfawley 8ff8683602
Implement transparent retries for gRFC A6 (#1597) 2017-11-06 13:45:11 -08:00
dfawley 551f295763
server: add EXPERIMENTAL tag to grpc.ConnectTimeout (#1652) 2017-11-06 10:29:48 -08:00
dfawley 4318e6475c
server: apply deadline to new connections until all handshaking is completed (#1646) 2017-11-03 13:53:17 -07:00
Zhouyihai Ding 5db344a40a Introduce new Compressor/Decompressor API (#1428) 2017-10-31 10:21:13 -07:00
dfawley c5f391bd6c Revert "cap max msg size to min(max_int, max_uint32) (#1598)" (#1619)
This reverts commit 5856538706.
2017-10-25 10:31:00 -07:00
lyuxuan 5856538706 cap max msg size to min(max_int, max_uint32) (#1598) 2017-10-24 10:20:54 -07:00
Shangpeng Sun 473b14250d Serve() should not return error on Stop() or GracefulStop() (#1485)
* Serve() should not return error on Stop() or GracefulStop()
* Block Serve() until Stop() or GracefulStop() returns
2017-10-18 15:27:24 -07:00
田欧 faebfcb7bf Remove single-entry var blocks (#1589) 2017-10-18 09:59:23 -07:00
dfawley 5279edf262 Update UnknownServiceHandler comment to be clearer about interceptor behavior (#1566) 2017-10-05 16:17:40 -07:00
mmukhi 8214c28a62 Make IO Buffer size configurable. (#1544)
* Make IO Buffer size configurable.

* Fixing typo
2017-09-28 14:11:14 -07:00
mmukhi 894322f00c Dedicated goroutine for writing. (#1498) 2017-09-14 13:44:14 -07:00
ZhouyihaiDing 01089b2972 Remove buf copy when the compressor exist (#1427) 2017-08-25 12:26:38 -07:00
lyuxuan 9d99afc2fd Automatic WriteStatus for RecvMsg/SendMsg error on server side (#1409)
automatically WriteStatus if there's any error when RecvMsg/SendMsg on server side.
2017-08-14 12:24:23 -07:00
dfawley 73041be906 Add 'experimental' note to ServeHTTP godoc (#1429) 2017-08-08 08:58:35 -07:00
Brad Fitzpatrick 383b11435b Document Server.ServeHTTP (#1406)
Fixes #549
2017-08-07 13:10:34 -07:00
Menghan Li 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
Peter Mattis 57ff3285cf Catch invalid use of Server.RegisterService after Register.Serve (#828) 2017-06-26 10:39:47 -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
lyuxuan 9f919f7b81 Merge pull request #1165 from lyuxuan/service_config_pr
Expand service config support
2017-05-22 11:15:26 -07:00
Alexander Morozov 9bf8ea0a82 clientconn, server: replace time.After with time.NewTimer (#998)
When timeout is not hit `time.After` will leak unnecessary timer, so
it's better to stop timer explicitly.

Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
2017-05-19 15:57:10 -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 bdf9a640e4 add timeout test, add check or pointer filed in callOption, fix minor issues 2017-05-15 13:51:11 -07:00
lyuxuan 3ea287058c Merge branch 'master' into service_config_pr 2017-05-07 16:49:32 -07:00
Matt T. Proud 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
MakMukhi f3b5bf53ce Make window size configurable. (#1210)
* Make window size configurable.
2017-05-05 13:26:56 -07:00
Adele Zhou a40b8d44e0 Address the comments 2017-05-04 16:29:17 -07:00
Adele Zhou 7ddf89f9b7 Fix doc 2017-05-04 10:30:28 -07:00
kirk 0914b46180 don't add defer func if stats handler is nil (#1214) 2017-05-02 10:16:45 -07:00
Yuxuan Li ecbc34aaca move server defaults, delete defer cancel() in stream.go 2017-04-26 17:39:57 -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
Yuxuan Li 74a632af0e fix comments 2017-04-06 17:28:41 -07:00
Yuxuan Li aad28b3c55 add error handling for InvalidArgument error from sendResponse() 2017-04-06 14:40:53 -07:00
Yuxuan Li c6a3937033 fix send response error case 2017-04-06 14:30:59 -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
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 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
MakMukhi 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
Mahak Mukhi 82fb96a360 Rest of the implementation 2017-03-10 17:30:46 -08:00
Mahak Mukhi d9b58b5ce9 Initial commit 2017-03-09 15:33:28 -08:00
Michal Witkowski e59576b1bb add support for user-provided UnknownStreamHandler 2017-02-27 18:07:41 +00: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
Menghan Li 5ad7c5b8ca add always returns non-nil error comment to server.serve() 2016-12-08 13:48:11 -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 f80f54e4d9 fix failing tests 2016-11-08 21:22:07 -08:00
Menghan Li 6445dedfbc fix wrong context when handling stats 2016-11-08 18:17:14 -08:00
Menghan Li ff0b1db33e fix comments 2016-11-08 10:31:02 -08:00
Menghan Li d23fdd776b fix comments 2016-11-07 15:32: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 c698588285 Renaming types and variables 2016-11-07 15:16:52 -08:00
Menghan Li 1054f1c42b add payload with original type to payload stats 2016-11-07 15:16:52 -08:00
Menghan Li 85c5e0e3b6 add errorStats 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
iamqizhao f3469bf27a add the missing comment 2016-11-03 16:46:21 -07:00
iamqizhao b85d2b0be5 Support transport tap 2016-11-03 14:21:24 -07:00
Mark Nevill bac9e1d16e Make concurrent Server.GracefulStop calls all behave equivalently. 2016-10-17 13:18:45 +01:00
Qi Zhao b057848384 Merge pull request #914 from flisky/master
fix server exit due to a temporary network error
2016-10-14 11:34:03 -07:00
Yin Jifeng e966e94443 fix server exit due to a temporary network error 2016-10-14 11:49:54 +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 1c20514d29 Make grpc.SendHeader return rpc error 2016-09-09 11:36:01 -07:00
Qi Zhao 8d57dd3404 Merge pull request #874 from menghanl/avoid_streamerror
Fix server side errors
2016-09-02 14:30:07 -07:00
Eric Drechsel 3bea3c5f8b Doc: Fix typo in func (s *Server) comment 2016-09-02 12:20:15 -07:00
Menghan Li 5e734ab23e Avoid creating transport stream error outside of transport 2016-09-02 11:57:42 -07:00
Menghan Li 0c58a17d6f Add credentials ErrConnDispatch 2016-08-24 16:20:57 -07:00
iamqizhao bcbb6549ac Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-29 16:20:08 -07:00
iamqizhao b13920a0cf add the mem alloc guard on server 2016-07-29 16:19:20 -07:00
iamqizhao 0f3fc4355d refactor GracefulStop a bit 2016-07-29 10:59:24 -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 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
Tamir Duberstein ac90a026b6
*: go vet 2016-07-27 23:39:19 -04:00
iamqizhao 110450d45e fix races introduce by goaway 2016-07-27 17:27:10 -07:00
iamqizhao 8c908a8c1d Reject over-sized requests on server 2016-07-26 16:44:49 -07:00
iamqizhao f78100723d Merge branch 'master' of https://github.com/grpc/grpc-go 2016-07-26 14:04:25 -07:00
iamqizhao b071b83367 limit max msg size on server 2016-07-26 14:04:19 -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
Qi Zhao 7428593149 Merge pull request #759 from menghanl/streams_in_serviceinfo_comments
Fix comments
2016-07-14 10:55:28 -07:00
Alexander Morozov 47de9c3564 server: close only non-closed listeners
The listener can be closed twice: in Close and in Serve. It might lead to
pretty bad things, for example, https://golang.org/src/net/unixsock_posix.go#L340
can delete a file which created by another listener.

Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
2016-07-12 21:16:45 -07:00
Menghan Li 42a2879989 Modify comments 2016-07-11 16:25:52 -07:00
Menghan Li bc8885608f Merge unary RPC info and streaming RPC info 2016-07-11 13:09:50 -07:00
Menghan Li 0ea9f970c0 Add StreamInfo for streaming types 2016-07-11 12:09:05 -07:00
Menghan Li a518fa911d Split methods and streams in service info 2016-07-11 12:09:05 -07:00
Daniel Ruehle 3802318f46 Make Errorf return pointer to rpcError 2016-07-08 10:28:36 -07:00
Menghan Li 078c90026f Minor fixes 2016-06-27 14:51:09 -07:00
Menghan Li 26d2db5487 Add server.GetServiceInfo().
To replace server.ServiceMetadata() and server.AllServiceNames().
2016-06-27 12:01:05 -07:00
Menghan Li 69c7425a21 Change server.ServiceMetadata to take service name and method name.
And some minor changes.
2016-06-27 12:01:05 -07:00
Menghan Li efe8d5f0f7 Add function AllServiceNames() to Server 2016-06-27 12:01:05 -07:00
Menghan Li e826825578 Add function Metadata() to Server 2016-06-27 12:01:05 -07:00
Menghan Li ad71085be9 Add metadata when registering service 2016-06-27 12:01:05 -07:00
Qi Zhao 3efe7aef96 Merge pull request #713 from menghanl/split_authenticator_and_credentials
[API revision] Separate TransportAuthenticator and PerRPCCredentials
2016-06-09 14:57:55 -07:00
Menghan Li 59486d9c17 Rename TransportAuthenticator to TransportCredentials 2016-06-08 11:19:25 -07:00