1126 Commits

Author SHA1 Message Date
d2d9c0a73a Fix flakiness of TestCancelNoIO with http.Handler-based server transport.
It wasn't closing the recvBuffer body in all cases during shutdown.

This change also:

* adds a new test with concurrent streams doing their own serial sends.
  This test was part of earlier debugging, but exists now to add more
  test coverage around concurrency.

* starts a cleanup of the end2end testing code, to be continued later.
  but the cleanup was necessary when writing the new test to be clean
  and not add more positional parameters.

* documents the concurrency expectations of the ServerTransport
  interface, cleaning up some other nearby documentation in the
  process.

* speeds up TestCancelNoIO to cancel some contexts once no longer
  needed, adding some comments about what the test is doing, adds some
  TODOs, and reduces some overly-long sleeps.
2016-02-12 23:24:53 +00:00
9f93868582 Merge pull request #550 from dsymonds/patch-1
Fix typo.
2016-02-12 10:57:44 -08:00
10e70583f7 Fix typo. 2016-02-12 15:19:47 +11:00
0631ecafac Merge pull request #514 from bradfitz/servehttp
Add a ServeHTTP method to *grpc.Server
2016-02-11 19:42:19 -08:00
7346c871b0 Add a ServeHTTP method to *grpc.Server
This adds new http.Handler-based ServerTransport in the process,
reusing the HTTP/2 server code in x/net/http2 or Go 1.6+.

All end2end tests pass with this new ServerTransport.

Fixes grpc/grpc-go#75

Also:
Updates grpc/grpc-go#495 (lets user fix it with middleware in front)
Updates grpc/grpc-go#468 (x/net/http2 validates)
Updates grpc/grpc-go#147 (possible with x/net/http2)
Updates grpc/grpc-go#104 (x/net/http2 does this)
2016-02-12 00:16:28 +00:00
3c4302b713 Merge pull request #543 from bradfitz/teststuff
test: misc cleanups
2016-02-10 16:46:20 -08:00
a48bc608df Merge pull request #544 from bradfitz/http_util
transport: don't crash if peer sends an empty header field name
2016-02-10 15:52:38 -08:00
a0dda98c3b Merge pull request #542 from bradfitz/race_min
test: shorten goroutine-heavy test in race mode
2016-02-10 15:49:08 -08:00
8aa7cbbc33 transport: don't crash if peer sends an empty header field name
The grpc-http2 transport doesn't validate hpack-decoded field names to be
valid http2 field names before checking their first byte. Had it verified
first and found that the empty string is illegal, this crash wouldn't happen,
but currently a malicious request can crash a gRPC server by sending an empty
hpack string.
2016-02-10 21:53:30 +00:00
a62244ef28 test: misc cleanups
* test header and metadata separately
* fix an incorrect error message
* ignore optional header fields in response (date, trailer)
2016-02-10 21:37:18 +00:00
3d9421a8e5 test: shorten goroutine-heavy test in race mode
The go race detector has a limit on how many goroutines it can track.
This test is only barely acceptable and the presence of any new
goroutines push it over the edge. Shorten this test is race mode.
2016-02-10 21:30:19 +00:00
51d644aca6 Merge pull request #541 from bradfitz/docs
Update Server.Stop docs per code review comments from grpc/grpc-go#540
2016-02-09 16:14:29 -08:00
07d3de883f Update Server.Stop docs per code review comments from grpc/grpc-go#540 2016-02-09 23:50:03 +00:00
af41c9cc8e Merge pull request #540 from iamqizhao/master
refine the comments of grpc.Server.Stop()
2016-02-09 15:38:37 -08:00
854ad3492a refine the comments of grpc.Server.Stop() 2016-02-09 15:22:53 -08:00
e390a33099 Merge pull request #538 from iamqizhao/master
Improve an error message
2016-02-09 11:31:51 -08:00
e000b83ffb Improve an error message 2016-02-09 11:16:47 -08:00
36d0fa20a1 Merge pull request #535 from iamqizhao/master
Close ServerTransport instead of the raw connection
2016-02-08 17:06:23 -08:00
6079240b2c remove fail_on_leak flag 2016-02-08 14:50:27 -08:00
77ccaa8fb2 Close ServerTransport instead of the raw connection 2016-02-08 14:27:06 -08:00
16885aa34b Merge pull request #529 from bradfitz/leaks
Fix test-only goroutine leaks; add leak checker to end2end tests.
2016-02-08 10:51:53 -08:00
fc0c458b89 Fix test-only goroutine leaks; add leak checker to end2end tests.
Some leaks remain, so this is disabled for now.

Updates grpc/grpc-go#528
2016-02-08 15:03:15 +00:00
933601d8cd Merge pull request #527 from tamird/regen-protos
`make proto`
2016-02-05 10:43:27 -08:00
accbf4c185 make proto 2016-02-04 17:35:04 -05:00
66b94b9f6b Merge pull request #525 from ejona86/sync-proto
Sync example protos from main repository
2016-02-03 16:46:24 -08:00
d3c0f79fa5 Sync example protos from main repository
grpc/grpc-java#1381
2016-02-03 10:14:35 -08:00
5d64098b94 Merge pull request #517 from zellyn/zellyn-grpclog-comments
Comment: explain concurrent access to grpclog.logger
2016-02-01 13:55:10 -08:00
fbb51f41f2 Merge pull request #518 from bradfitz/fatalf2
Fix more cases of Fatalf being used from goroutines started by tests.
2016-02-01 13:54:57 -08:00
d52370625d Fix more cases of Fatalf being used from goroutines started by tests.
Follow-up to #515 based on comments there from @maniksurtani.
2016-02-01 21:01:14 +00:00
a0f854fec2 Merge pull request #515 from bradfitz/fatalf
Don't call t.FailNow in goroutines started by tests.
2016-02-01 12:50:34 -08:00
65e7361599 Comment: explain concurrent access to grpclog.logger
grpc's pluggable logger is not mutex-protected: added comments that it
should be changed only in init() functions.
2016-02-01 15:07:17 -05:00
8024a575aa Don't call t.FailNow in goroutines started by tests.
The docs at https://golang.org/pkg/testing/#T.FailNow say:

> FailNow must be called from the goroutine running the test or
> benchmark function, not from other goroutines created during the
> test.

(Fatalf is documented as "Fatalf is equivalent to Logf followed by
FailNow.")

This was manifesting itself as a race with two concurrently failing
goroutines in my other CL, masking whatever the real problem was.
2016-02-01 19:15:37 +00:00
93591e7568 Merge pull request #508 from bradfitz/master
server: break up the Server.Serve method into some reusable parts
2016-01-29 15:51:48 -08:00
9d2ecf553a server: break up the Server.Serve method into some reusable parts
Updates grpc/grpc-go#75
2016-01-29 23:20:54 +00:00
2e0ced7711 Merge pull request #513 from iamqizhao/master
Simplify compression API
2016-01-29 15:17:11 -08:00
af8888dc8d remove Compressor/DecompressorGenerator 2016-01-29 14:38:20 -08:00
3f30c980d6 Merge pull request #509 from iamqizhao/master
Tune the server accepting code
2016-01-29 10:31:52 -08:00
9ec0eadc55 fix a nil map access bug 2016-01-28 18:51:38 -08:00
35db64de36 Tune the server accepting code 2016-01-28 15:59:36 -08:00
23d551898c Merge pull request #505 from iamqizhao/master
Force flush headers frame for bi-di streaming
2016-01-27 19:03:04 -08:00
6d87263bd5 add test 2016-01-27 18:34:24 -08:00
086f6de8a8 force flush headers frame for server streaming and bi-di streaming 2016-01-27 16:39:34 -08:00
1147a9f0e9 Merge pull request #504 from iamqizhao/master
remove some commented code left from previous PRs
2016-01-26 17:49:40 -08:00
48d3f37c1f remove some commented code left from previous PR 2016-01-26 16:21:22 -08:00
e29d659177 Merge pull request #500 from iamqizhao/master
Support connection level compression
2016-01-25 14:39:43 -08:00
8ced3f96cb gofmt 2016-01-25 12:48:13 -08:00
6ad5faf0d7 more comments 2016-01-25 12:46:28 -08:00
a9cd71320c add more comments 2016-01-25 11:52:24 -08:00
4258b32de7 Don't create buffer if compressor is nil 2016-01-25 11:47:04 -08:00
61d7c39d4c comments and gofmt 2016-01-25 11:18:41 -08:00