Commit Graph

1096 Commits

Author SHA1 Message Date
Brad Fitzpatrick 18b2da6250 Simplify server setup when testing the http.Handler-based server transport
This simplifies the code that's used for wiring up the http.Handler-based
transport for testing. It's not used outside of tests.

http2.Server.ServeConn was added somewhat recently for other reasons and
I just realized it would simplify this code as well.
2016-03-02 18:49:23 +00: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
Qi Zhao 4d5449a400 Merge pull request #568 from iamqizhao/master
Add more uninteresting goroutines for the leak checker
2016-02-23 18:29:23 -08:00
Qi Zhao 3657de165d Merge pull request #567 from pquerna/log_handshake_error
log error message and source address in handshake error
2016-02-23 16:02:59 -08:00
iamqizhao 91254844e8 add more uninteresting goroutines for leak checker 2016-02-23 16:01:42 -08:00
Paul Querna 75fe76716d log error message and source address in handshake error 2016-02-23 11:14:03 -08:00
Qi Zhao f1af61b295 Merge pull request #565 from iamqizhao/master
Always close tracing when a streaming rpc goes wrong.
2016-02-23 10:46:04 -08:00
iamqizhao 5085c7628d Always close tracing when a stream goes wrong 2016-02-22 18:02:10 -08:00
Qi Zhao 19b24c3042 Merge pull request #564 from iamqizhao/master
Fix a race between transport creation and wait returning
2016-02-22 17:50:41 -08:00
iamqizhao 0be94ab3f5 fix a race between transport creation and wait returning 2016-02-22 16:26:15 -08:00
Qi Zhao 74d8091165 Merge pull request #563 from iamqizhao/doc
fix the grpc website url
2016-02-22 13:07:33 -08:00
Yang Gao cbf3e92183 Merge pull request #560 from iamqizhao/health
change health check package name
2016-02-22 11:32:06 -08:00
iamqizhao a5125ecf39 fix the grpc website url 2016-02-19 11:56:12 -08:00
iamqizhao 3839435526 change health check package name 2016-02-18 13:10:06 -08:00
Qi Zhao 178b68e281 Merge pull request #556 from bradfitz/testcleanup
test: improve test readability; use newTest helper everywhere
2016-02-17 15:38:44 -08:00
Brad Fitzpatrick b1097423a0 test: improve test readability; use newTest helper everywhere
This removes serverSetUp and clientSetUp. They had too many positional
parameters and weren't readable at the call sites.

With this change, it's now much more obvious how a test differs from
others just be looking at what is tinkered with after newTest.

Change-Id: I59bb06f8029af166002033f2c3f7b8f0b2d20940
2016-02-16 11:15:16 +00:00
Qi Zhao 01de3de50a Merge pull request #546 from bradfitz/quiet
test: reduce end2end log spam
2016-02-16 01:02:10 -08:00
Qi Zhao 0080e0eda0 Merge pull request #552 from bradfitz/concurrency
Fix flakiness of TestCancelNoIO with http.Handler-based server transport
2016-02-12 17:16:34 -08:00
Brad Fitzpatrick ffa8131f46 test: reduce end2end log spam
Filter expected log output by default, unless a flag is provided, or a
test fails.

This makes it possible to see unexpected things. Having noisy tests
makes it too easy to miss actual problems.
2016-02-13 00:33:23 +00:00
Brad Fitzpatrick 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
Qi Zhao 9f93868582 Merge pull request #550 from dsymonds/patch-1
Fix typo.
2016-02-12 10:57:44 -08:00
David Symonds 10e70583f7 Fix typo. 2016-02-12 15:19:47 +11:00
Qi Zhao 0631ecafac Merge pull request #514 from bradfitz/servehttp
Add a ServeHTTP method to *grpc.Server
2016-02-11 19:42:19 -08:00
Brad Fitzpatrick 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
Qi Zhao 3c4302b713 Merge pull request #543 from bradfitz/teststuff
test: misc cleanups
2016-02-10 16:46:20 -08:00
Qi Zhao 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
Qi Zhao 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
Brad Fitzpatrick 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
Brad Fitzpatrick 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
Brad Fitzpatrick 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
Qi Zhao 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
Brad Fitzpatrick 07d3de883f Update Server.Stop docs per code review comments from grpc/grpc-go#540 2016-02-09 23:50:03 +00:00
Qi Zhao af41c9cc8e Merge pull request #540 from iamqizhao/master
refine the comments of grpc.Server.Stop()
2016-02-09 15:38:37 -08:00
iamqizhao 854ad3492a refine the comments of grpc.Server.Stop() 2016-02-09 15:22:53 -08:00
Qi Zhao e390a33099 Merge pull request #538 from iamqizhao/master
Improve an error message
2016-02-09 11:31:51 -08:00
iamqizhao e000b83ffb Improve an error message 2016-02-09 11:16:47 -08:00
Qi Zhao 36d0fa20a1 Merge pull request #535 from iamqizhao/master
Close ServerTransport instead of the raw connection
2016-02-08 17:06:23 -08:00
iamqizhao 6079240b2c remove fail_on_leak flag 2016-02-08 14:50:27 -08:00
iamqizhao 77ccaa8fb2 Close ServerTransport instead of the raw connection 2016-02-08 14:27:06 -08:00
Qi Zhao 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
Brad Fitzpatrick 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
Qi Zhao 933601d8cd Merge pull request #527 from tamird/regen-protos
`make proto`
2016-02-05 10:43:27 -08:00
Tamir Duberstein accbf4c185 `make proto` 2016-02-04 17:35:04 -05:00
Qi Zhao 66b94b9f6b Merge pull request #525 from ejona86/sync-proto
Sync example protos from main repository
2016-02-03 16:46:24 -08:00
Eric Anderson d3c0f79fa5 Sync example protos from main repository
grpc/grpc-java#1381
2016-02-03 10:14:35 -08:00
Qi Zhao 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
Qi Zhao 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
Brad Fitzpatrick 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
Qi Zhao 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