Commit Graph

2272 Commits

Author SHA1 Message Date
Eric Anderson de8b411773 compiler: Fix some warnings when building with Bazel
This fixes sign-compare and maybe-unintialized. An unused-value warning
remains.

I changed LogHelper to always call abort so the compiler would know the
method does not return, which fixed the maxbe-uninitialized warning.
2017-08-02 14:29:40 -07:00
Stephen Haberman db9b7ed8c0 Don't schedule multiple pings.
If onTransportActive ran while SendPing was already scheduled, we would
schedule another SendPing, which seems fine, but the server might observe
us sending pings too quickly, and make us GOAWAY.

Fixes #3274.
2017-08-01 11:25:24 -07:00
ZHANG Dapeng 18970e6ef3 core: fix ConnectivityStateManager is already disabled bug 2017-08-01 10:26:02 -07:00
Eric Gribkoff c0e010af8f interop-testing: implement compression interop tests 2017-07-31 16:08:23 -07:00
Kun Zhang a3a306fd4e core: enable Census tags propagation by default. (#3294)
According to Census team, the tag wire format is now stable.
2017-07-31 14:55:48 -07:00
Kun Zhang f54a2df67f grpclb: force GRPCLB policy when NameResolver returns at least one balancer. (#3291)
Previously only when all addresses returned by NameResolver are
balancers would GRPCLB be forced.  This change is a follow-up of
https://github.com/grpc/grpc/pull/10258
2017-07-31 11:07:11 -07:00
Eric Anderson 9be41ba0e8 core,auth: Stabilize auth flow using CallCredentials
As discussed in #1914, we need CallCredentials and MoreCallCredentials
to be stable, but there's less of a strong need for the contents of
CallCredentials to be stable. We're willing to commit to the name,
without needing to commit to the plumbing.
2017-07-27 18:07:18 -07:00
Carl Mastrangelo 3efaccd81f netty: support `status()` on Headers
* netty: support `status()` on Headers

Recent Netty change a91df58ca1
caused the `status()` method to be invoked, which AbstractHttp2Headers does not implement.
This change is necesary to upgrade to Netty 4.1.14
2017-07-27 12:17:27 -07:00
Kun Zhang 04e0450304 core: pass CallOptions to newClientStreamTracer(). (#3276)
Resolves #3256
2017-07-27 12:07:25 -07:00
ZHANG Dapeng da47085dbb benchmarks: fix [MissingOverride]
```
:grpc-benchmarks:compileJavaC:\jenkins\workspace\gRPC-Java-PR-Windows\benchmarks\src\main\java\io\grpc\benchmarks\qps\AbstractConfigurationBuilder.java:58: warning: [MissingOverride] getDefaultValue implements method in Param; expected @Override
    public String getDefaultValue() {
                  ^
    (see http://errorprone.info/bugpattern/MissingOverride)
  Did you mean '@Override public String getDefaultValue() {'?
error: warnings found and -Werror specified
1 error
1 warning
 FAILED

FAILURE: Build failed with an exception.
```
2017-07-26 13:18:00 -07:00
Vladimir Gordiychuk 00fe090ac1 context: Create TimeoutException only when deadline occurs
Use deadline on client calls lead to create TimeoutException even
if deadline not occurs yet. fillStacktrack very expensive operation
that allocate many unnecessary objects in heap. Now exception
creates only when deadline occurs.

Close #3272
2017-07-25 15:53:37 -07:00
Ryan Michela 3731a5dfcc Implemented ClientCallStreamObserver.cancel() 2017-07-25 14:36:51 -07:00
Eric Anderson bd743f3afd core: Channel uses transport's ScheduledExecutorService
Coupled with the similar change on server-side, this removes the need for a
thread when using Netty. For InProcess and OkHttp, it would allow us to let the
user to provide the scheduler for tests or application-wide thread sharing.
2017-07-25 14:26:16 -07:00
ZHANG Dapeng 883a85ee93 core,netty,okhttp: remove 2-arg ClientTransport.newStream()
to keep only one `newStream()` method in the `ClientTransport` interface
2017-07-25 14:12:36 -07:00
Kun Zhang 0fb0fda3e1 core: Override SubchannelImpl.toString() (#3265)
LoadBalancer may log subchannels. This makes the logs more informative.
2017-07-21 17:13:35 -07:00
ZHANG Dapeng db279eb3c1 context: add test for the scenario that Context's logger itself is using Context
This will break if
7f1ac34d41,
2f6e2c87ab,
a3a5420922
are reverted:

```
io.grpc.ContextTest > initContextWithCustomClassLoaderWithCustomLogger FAILED
    java.lang.ExceptionInInitializerError
        at io.grpc.ContextTest$LoadMeWithStaticTestingClassLoader.run(ContextTest.java:789)
        at io.grpc.ContextTest.initContextWithCustomClassLoaderWithCustomLogger(ContextTest.java:760)

        Caused by:
        java.lang.RuntimeException: Storage override had failed to initialize
            at io.grpc.Context.storage(Context.java:134)
            at io.grpc.Context.current(Context.java:163)
            at io.grpc.ContextTest$LoadMeWithStaticTestingClassLoader$1.publish(ContextTest.java:773)
            at java.util.logging.Logger.log(Logger.java:738)
            at java.util.logging.Logger.doLog(Logger.java:765)
            at java.util.logging.Logger.log(Logger.java:875)
            at io.grpc.Context.<clinit>(Context.java:122)
            ... 2 more
```
2017-07-21 15:20:02 -07:00
Eric Anderson 7f1ac34d41 context: Lazy load storage
Using static initialization is possible, but quite complex to handle
logging and circular loading. Lazy loading prevents an entire class of
circular dependencies.
2017-07-20 16:34:05 -07:00
Eric Anderson 924b0b2b00 Revert "interop-testing: overrideAuthority breaks JWT"
This reverts commit 57b9105c7f.

Issue #2682 is fixed, so we can revert the commit as planned. This
re-applies a previously-reverted modernization.
2017-07-19 13:54:32 -07:00
ZHANG Dapeng 946c29ac32 core: not to expose ClientCallImpl#cancelled() 2017-07-19 12:08:57 -07:00
ZHANG Dapeng 7e9e5a55b1 channel state API plumbing
This is only implementing how subchannel state changes are hooked up to channel state APIs. Debates in state semantics and transition rules for loadbalanced channel such as #2873 are not addressed. Any changes in state semantics and transition rules in the future can be easily adapted.
2017-07-19 11:56:00 -07:00
Eric Anderson 994f200d15 core: Server uses transport's ScheduledExecutorService
For Netty, this reduces the number of threads necessary for servers (although
until channel is converted, actual number of threads isn't impacted) and
naturally reduces contention and timeout latency.

For InProcess, this gets us closer to allowing applications to provide all
executors, which is especially useful during tests.
2017-07-19 10:31:26 -07:00
Eric Anderson d325919f62 core: Use Class.forName(String) in provider for Android
Class.forName(String) is understood by ProGuard, removing the need for
manual ProGuard configuration and allows ProGuard to rename the provider
classes. Previously the provider classes could not be renamed.

Fixes #2633
2017-07-19 10:15:03 -07:00
Carl Mastrangelo 8572f5ff6b all: update animal sniffer and error prone 2017-07-18 13:53:45 -07:00
Carl Mastrangelo 2175004363 all: recommend latest os maven detector 2017-07-18 10:44:37 -07:00
Carl Mastrangelo 84fce477c2 all: fix minor lint warnings 2017-07-17 17:21:07 -07:00
zpencer e14fc404f0 netty: add timeouts to address test flakiness (#3169)
This test is sometimes flakey
2017-07-17 17:14:16 -07:00
Carl Mastrangelo 6ea2b8aacb examples: fix errorprone warning about charset 2017-07-17 15:35:08 -07:00
Carl Mastrangelo e60a179772 core: hide access to pseudo headers
Previously anyone could create metadata keys with a leading ":", due to not having a way to prevent it. This change effectively only allows internal code to make use of this.
2017-07-17 11:00:53 -07:00
zpencer 5713ebccba build.gradle: intellij fix for gradle 4.0 (#3243)
Without this config change, unit tests will not be runnable in
intellij using gradle 4.0

gradle/gradle#2315
2017-07-15 12:41:20 -07:00
Carl Mastrangelo e7d5e211d7 benchmarks: don't block shutdown when using netty 2017-07-14 18:22:25 -07:00
ZHANG Dapeng 86ef4c50d3 testing-proto: add string message to simpleservice.proto to facilitate testing
It was not convenient to test in some scenarios without having a field in the message. All `SimpleResponse` messages were `equals` to each other. Users might not want to assume reference identity/inequality between server and client for equal/unequal messages even for InProcess. Even with reference identity, it would still be inconvenient if their were hundreds of messages.

To have a  non-proto based String to String service instead is another solution, but the usefulness of this proto based service would still be too limited.
2017-07-14 16:23:16 -07:00
Ian Haken 677c84e1d4 okhttp: Add support for specifying a custom hostname verifier when using on OkHttpChannelBuilder. 2017-07-14 16:04:15 -07:00
zpencer ec4837bf10 netty: quieter errors in NettyServerTransport (#3234)
Some errors such as connection resets should be logged at FINE, the
rest should be INFO rather than SEVERE.

fixes #1768
2017-07-14 13:59:36 -07:00
Carl Mastrangelo f735fc1907 stub: name more anonymous classes 2017-07-14 13:38:27 -07:00
Carl Mastrangelo 193fd057a5 stub: clean up client calls to avoid synthetic class 2017-07-14 13:38:04 -07:00
Carl Mastrangelo e6ad90e43e examples: don't use deprecated MethodDescriptor API 2017-07-14 12:36:18 -07:00
Carl Mastrangelo d34260a814 all: update to proto gradle plugin 0.8.1 2017-07-14 12:35:14 -07:00
ZHANG Dapeng 1661b51272 core: refactor SubchannelImpl
* refactor SubchannelImpl -> AbstractSubchannel

The old `SubchannelImpl` is actually not implementing anything, and the old `SubchannelImplImpl` has a weird name.
2017-07-14 11:05:09 -07:00
Carl Mastrangelo b6449a14dd benchmarks: add initial context benchmarks 2017-07-13 15:42:27 -07:00
Carl Mastrangelo d387bfe72f stub: Use named classes rather than anonymous in ServerCalls
This has a number of small benefits.  First, it makes stack traces
easier to read.  For example:

Old class names:
```
ServerCalls$1$1.class
ServerCalls$1.class
ServerCalls$2$1.class
ServerCalls$2.class
```

New class names:
```
ServerCalls$StreamingServerCallHandler.class
ServerCalls$StreamingServerCallHandler$StreamingServerCallListener.class
ServerCalls$UnaryServerCallHandler.class
ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.class
```

This is much easier to read quickly, espcially if line numbers don't
match between HEAD and the code that prints the stack trace.

Another benefit of this is that it drops a class file from the jar
(`EmptyServerCallListener`).

Lastly, it makes it easier in the future to test, since the specific
class can be referenced from a test.  Traditionally this class
hasn't been easy to test.
2017-07-13 14:33:25 -07:00
zpencer 26caa488a5 core: update javadocs regarding ClientCall mocks (#3140)
Change the @DoNotMock message to refer to InProcessServerBuilder, and include some usage examples that users may find useful.

fixes #3124
2017-07-13 08:19:29 -07:00
ZHANG Dapeng 29befc131d doc: update external link 2017-07-12 16:31:55 -07:00
Mehrdad Afshari 68d73fa4d6 doc: Uppercase Java 2017-07-12 14:35:56 -07:00
Carl Mastrangelo 0b50095aa6 all: update to gradle 4.0.1
There is a deadlock in 4.0.0 with running tests in parallel
2017-07-12 10:07:14 -07:00
Bogdan Drutu 482b651605 core: Change gRPC to use io.opencensus:opencensus-api:0.5.1. (#3204) 2017-07-11 10:13:23 -07:00
Matt Kwong 5cf469ae0b all: make Kokoro show actual Gradle results (#3208) 2017-07-10 17:26:33 -07:00
ZHANG Dapeng ff0ad5fac3 testing: refactor part of TestUtils to internal
Moved the following APIs from `io.grpc.testing.TestUtils` to `io.grpc.internal.TestUtils`:

`InetSocketAddress testServerAddress(String host, int port)`
`InetSocketAddress testServerAddress(int port)`
`List<String> preferredTestCiphers()`
`File loadCert(String name)`
`X509Certificate loadX509Cert(String fileName)`
`SSLSocketFactory newSslSocketFactoryForCa(Provider provider, File certChainFile)`
`void sleepAtLeast(long millis)`

APIs not to be moved:

`ServerInterceptor recordRequestHeadersInterceptor()`
`ServerInterceptor recordServerCallInterceptor()`
2017-07-10 16:30:38 -07:00
Mehrdad Afshari 8ce0bc25b6 Canonicalize URL prefixes to https://grpc.io 2017-07-10 16:30:09 -07:00
Carl Mastrangelo 7207a9f408 all: update to netty 4.1.13 2017-07-10 15:02:03 -07:00
Eric Anderson e6d0062d20 Move checkstyle config to buildscripts/
Checkstyle configuration is just noise in the root directory. Neither
users nor developers need to look at it often.
2017-07-07 17:11:40 -07:00