Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grpc/grpc-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.49.0
Choose a base ref
...
head repository: grpc/grpc-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.49.1
Choose a head ref
  • 9 commits
  • 39 files changed
  • 5 contributors

Commits on Aug 23, 2022

  1. Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    cf10676 View commit details

Commits on Sep 6, 2022

  1. xDS interop: enable pod log collection in the buildscripts (#9495) (#…

    …9512)
    
    - Enables pod log collection in all PSM interop jobs implemented
      in grpc/grpc#30594.
    - Associate test suite runs with their own log file, so it's displayed
      on the "Target Log" tab
    - Updates security job to not stop after a failed suite, so that
      authz_test run even if security_test failed
    - Fix run_test not returning correct exit status, causing false
      positives in some cases. See grpc/grpc#30768
    sergiitk authored Sep 6, 2022
    Copy the full SHA
    46eb94d View commit details

Commits on Sep 12, 2022

  1. [core,api,auth: Choose executor based on need for thread affinity (#9504

    ) (#9524)
    
    * core,api,auth: Choose the callOptions executor when applying request metadata to credentials during newStream based upon whether AppEngineCredentials are being used as they require a specific thread to do the processing.
    
    Add an interface to differentiate whether the specific thread is needed.
    
    Fixes b/244209681
    larry-safran authored Sep 12, 2022
    Copy the full SHA
    d0848ef View commit details

Commits on Sep 14, 2022

  1. xds: ringhash policy in TRANSIENT_FAILURE should not attempt connecti…

    …ng when already in connecting (#9535) (#9537)
    YifeiZhuang authored Sep 14, 2022
    Copy the full SHA
    e55bf31 View commit details

Commits on Sep 15, 2022

  1. core: Update outlier detection max ejection logic. (#9489) (#9550)

    Instead of strictly enforcing the max ejection percentage setting,
    allow one additional ejection past the maximum. This quarantees at least
    one ejection and matches Envoy proxy behavior.
    temawi authored Sep 15, 2022
    Copy the full SHA
    0e4e716 View commit details
  2. core: outlier detection to min host request volume (#9490) (#9551)

    When doing the failure percentage algorithm, ejections should be skipped
    if there are not enough addresses that meet the minimum volume
    requirement.
    temawi authored Sep 15, 2022
    Copy the full SHA
    0707aac View commit details
  3. core: outlier detection max ejection logic update (#9492) (#9552)

    Stop further ejection if the ejection percentage is lesser than or equal
    to the maximum ejection percentage. Previously this was only done when
    the current ejection percentage was lesser than the maximum.
    temawi authored Sep 15, 2022
    Copy the full SHA
    8b9acff View commit details
  4. Copy the full SHA
    c1e9c2b View commit details
  5. Bump version to 1.49.1

    YifeiZhuang committed Sep 15, 2022
    Copy the full SHA
    eb32ed1 View commit details
Showing with 251 additions and 117 deletions.
  1. +15 −15 README.md
  2. +22 −0 api/src/main/java/io/grpc/InternalMayRequireSpecificExecutor.java
  3. +37 −1 auth/src/main/java/io/grpc/auth/GoogleAuthLibraryCallCredentials.java
  4. +1 −1 build.gradle
  5. +1 −1 buildscripts/kokoro/psm-security.cfg
  6. +16 −6 buildscripts/kokoro/psm-security.sh
  7. +1 −1 buildscripts/kokoro/xds_k8s_lb.cfg
  8. +7 −3 buildscripts/kokoro/xds_k8s_lb.sh
  9. +1 −1 buildscripts/kokoro/xds_url_map.cfg
  10. +7 −3 buildscripts/kokoro/xds_url_map.sh
  11. +1 −1 compiler/src/test/golden/TestDeprecatedService.java.txt
  12. +1 −1 compiler/src/test/golden/TestService.java.txt
  13. +1 −1 compiler/src/testLite/golden/TestDeprecatedService.java.txt
  14. +1 −1 compiler/src/testLite/golden/TestService.java.txt
  15. +17 −2 core/src/main/java/io/grpc/internal/CallCredentialsApplyingTransportFactory.java
  16. +1 −1 core/src/main/java/io/grpc/internal/GrpcUtil.java
  17. +34 −24 core/src/main/java/io/grpc/util/OutlierDetectionLoadBalancer.java
  18. +45 −12 core/src/test/java/io/grpc/util/OutlierDetectionLoadBalancerTest.java
  19. +1 −1 cronet/README.md
  20. +2 −2 documentation/android-channel-builder.md
  21. +5 −5 examples/android/clientcache/app/build.gradle
  22. +4 −4 examples/android/helloworld/app/build.gradle
  23. +4 −4 examples/android/routeguide/app/build.gradle
  24. +4 −4 examples/android/strictmode/app/build.gradle
  25. +1 −1 examples/build.gradle
  26. +1 −1 examples/example-alts/build.gradle
  27. +1 −1 examples/example-gauth/build.gradle
  28. +2 −2 examples/example-gauth/pom.xml
  29. +1 −1 examples/example-hostname/build.gradle
  30. +2 −2 examples/example-hostname/pom.xml
  31. +1 −1 examples/example-jwt-auth/build.gradle
  32. +2 −2 examples/example-jwt-auth/pom.xml
  33. +1 −1 examples/example-orca/build.gradle
  34. +1 −1 examples/example-tls/build.gradle
  35. +2 −2 examples/example-tls/pom.xml
  36. +1 −1 examples/example-xds/build.gradle
  37. +2 −2 examples/pom.xml
  38. +1 −1 xds/src/main/java/io/grpc/xds/RingHashLoadBalancer.java
  39. +3 −3 xds/src/test/java/io/grpc/xds/RingHashLoadBalancerTest.java
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -31,8 +31,8 @@ For a guided tour, take a look at the [quick start
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
basics](https://grpc.io/docs/languages/java/basics).

The [examples](https://github.com/grpc/grpc-java/tree/v1.49.0/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.49.0/examples/android)
The [examples](https://github.com/grpc/grpc-java/tree/v1.49.1/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.49.1/examples/android)
are standalone projects that showcase the usage of gRPC.

Download
@@ -43,18 +43,18 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.49.0</version>
<version>1.49.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.49.0</version>
<version>1.49.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.49.0</version>
<version>1.49.1</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
@@ -66,23 +66,23 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:

Or for Gradle with non-Android, add to your dependencies:
```gradle
runtimeOnly 'io.grpc:grpc-netty-shaded:1.49.0'
implementation 'io.grpc:grpc-protobuf:1.49.0'
implementation 'io.grpc:grpc-stub:1.49.0'
runtimeOnly 'io.grpc:grpc-netty-shaded:1.49.1'
implementation 'io.grpc:grpc-protobuf:1.49.1'
implementation 'io.grpc:grpc-stub:1.49.1'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```

For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
`grpc-protobuf-lite` instead of `grpc-protobuf`:
```gradle
implementation 'io.grpc:grpc-okhttp:1.49.0'
implementation 'io.grpc:grpc-protobuf-lite:1.49.0'
implementation 'io.grpc:grpc-stub:1.49.0'
implementation 'io.grpc:grpc-okhttp:1.49.1'
implementation 'io.grpc:grpc-protobuf-lite:1.49.1'
implementation 'io.grpc:grpc-stub:1.49.1'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```

[the JARs]:
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.49.0
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.49.1

Development snapshots are available in [Sonatypes's snapshot
repository](https://oss.sonatype.org/content/repositories/snapshots/).
@@ -114,7 +114,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.21.1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.49.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.49.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
@@ -144,7 +144,7 @@ protobuf {
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.49.0'
artifact = 'io.grpc:protoc-gen-grpc-java:1.49.1'
}
}
generateProtoTasks {
@@ -177,7 +177,7 @@ protobuf {
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.49.0'
artifact = 'io.grpc:protoc-gen-grpc-java:1.49.1'
}
}
generateProtoTasks {
22 changes: 22 additions & 0 deletions api/src/main/java/io/grpc/InternalMayRequireSpecificExecutor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2022 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.grpc;

@Internal
public interface InternalMayRequireSpecificExecutor {
boolean isSpecificExecutorRequired();
}
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
import com.google.auth.RequestMetadataCallback;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.io.BaseEncoding;
import io.grpc.InternalMayRequireSpecificExecutor;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.SecurityLevel;
@@ -44,13 +45,16 @@
/**
* Wraps {@link Credentials} as a {@link io.grpc.CallCredentials}.
*/
final class GoogleAuthLibraryCallCredentials extends io.grpc.CallCredentials {
final class GoogleAuthLibraryCallCredentials extends io.grpc.CallCredentials
implements InternalMayRequireSpecificExecutor {
private static final Logger log
= Logger.getLogger(GoogleAuthLibraryCallCredentials.class.getName());
private static final JwtHelper jwtHelper
= createJwtHelperOrNull(GoogleAuthLibraryCallCredentials.class.getClassLoader());
private static final Class<? extends Credentials> googleCredentialsClass
= loadGoogleCredentialsClass();
private static final Class<?> appEngineCredentialsClass
= loadAppEngineCredentials();

private final boolean requirePrivacy;
@VisibleForTesting
@@ -59,6 +63,8 @@ final class GoogleAuthLibraryCallCredentials extends io.grpc.CallCredentials {
private Metadata lastHeaders;
private Map<String, List<String>> lastMetadata;

private Boolean requiresSpecificExecutor;

public GoogleAuthLibraryCallCredentials(Credentials creds) {
this(creds, jwtHelper);
}
@@ -242,6 +248,16 @@ private static Class<? extends Credentials> loadGoogleCredentialsClass() {
return rawGoogleCredentialsClass.asSubclass(Credentials.class);
}

@Nullable
private static Class<?> loadAppEngineCredentials() {
try {
return Class.forName("com.google.auth.appengine.AppEngineCredentials");
} catch (ClassNotFoundException ex) {
log.log(Level.FINE, "AppEngineCredentials not available in classloader", ex);
return null;
}
}

private static class MethodPair {
private final Method getter;
private final Method builderSetter;
@@ -353,4 +369,24 @@ public Credentials tryServiceAccountToJwt(Credentials creds) {
return creds;
}
}

/**
* This method is to support the hack for AppEngineCredentials which need to run on a
* specific thread.
* @return Whether a specific executor is needed or if any executor can be used
*/
@Override
public boolean isSpecificExecutorRequired() {
// Cache the value so we only need to try to load the class once
if (requiresSpecificExecutor == null) {
if (appEngineCredentialsClass == null) {
requiresSpecificExecutor = Boolean.FALSE;
} else {
requiresSpecificExecutor = appEngineCredentialsClass.isInstance(creds);
}
}

return requiresSpecificExecutor;
}

}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ subprojects {
apply plugin: "net.ltgt.errorprone"

group = "io.grpc"
version = "1.49.0" // CURRENT_GRPC_VERSION
version = "1.49.1" // CURRENT_GRPC_VERSION

repositories {
maven { // The google mirror is less flaky than mavenCentral()
2 changes: 1 addition & 1 deletion buildscripts/kokoro/psm-security.cfg
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ timeout_mins: 180
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
22 changes: 16 additions & 6 deletions buildscripts/kokoro/psm-security.sh
Original file line number Diff line number Diff line change
@@ -119,16 +119,20 @@ run_test() {
# Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
--kube_context="${KUBE_CONTEXT}" \
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--force_cleanup
set +x
--force_cleanup \
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
@@ -170,9 +174,15 @@ main() {
build_docker_images_if_needed
# Run tests
cd "${TEST_DRIVER_FULL_DIR}"
run_test baseline_test
run_test security_test
run_test authz_test
local failed_tests=0
test_suites=("baseline_test" "security_test" "authz_test")
for test in "${test_suites[@]}"; do
run_test $test || (( failed_tests++ ))
done
echo "Failed test suites: ${failed_tests}"
if (( failed_tests > 0 )); then
exit 1
fi
}

main "$@"
2 changes: 1 addition & 1 deletion buildscripts/kokoro/xds_k8s_lb.cfg
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ timeout_mins: 180
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
10 changes: 7 additions & 3 deletions buildscripts/kokoro/xds_k8s_lb.sh
Original file line number Diff line number Diff line change
@@ -118,6 +118,8 @@ run_test() {
# Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
@@ -126,9 +128,11 @@ run_test() {
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--force_cleanup
set +x
--force_cleanup \
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
2 changes: 1 addition & 1 deletion buildscripts/kokoro/xds_url_map.cfg
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ timeout_mins: 90
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
10 changes: 7 additions & 3 deletions buildscripts/kokoro/xds_url_map.sh
Original file line number Diff line number Diff line change
@@ -118,15 +118,19 @@ run_test() {
# Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
--flagfile="config/url-map.cfg" \
--kube_context="${KUBE_CONTEXT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--flagfile="config/url-map.cfg"
set +x
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
2 changes: 1 addition & 1 deletion compiler/src/test/golden/TestDeprecatedService.java.txt
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.49.0)",
value = "by gRPC proto compiler (version 1.49.1)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
@java.lang.Deprecated
2 changes: 1 addition & 1 deletion compiler/src/test/golden/TestService.java.txt
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.49.0)",
value = "by gRPC proto compiler (version 1.49.1)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class TestServiceGrpc {
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.49.0)",
value = "by gRPC proto compiler (version 1.49.1)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
@java.lang.Deprecated
2 changes: 1 addition & 1 deletion compiler/src/testLite/golden/TestService.java.txt
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.49.0)",
value = "by gRPC proto compiler (version 1.49.1)",
comments = "Source: grpc/testing/compiler/test.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class TestServiceGrpc {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 The gRPC Authors
* Copyright 2016,2022 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
import io.grpc.ChannelLogger;
import io.grpc.ClientStreamTracer;
import io.grpc.CompositeCallCredentials;
import io.grpc.InternalMayRequireSpecificExecutor;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.SecurityLevel;
@@ -144,7 +145,21 @@ public Attributes getTransportAttrs() {
}
};
try {
creds.applyRequestMetadata(requestInfo, appExecutor, applier);
// Hack to allow appengine to work when using AppEngineCredentials (b/244209681)
// since processing must happen on a specific thread.
//
// Ideally would always use appExecutor and we could eliminate the interface
// InternalMayRequireSpecificExecutor
Executor executor;
if (creds instanceof InternalMayRequireSpecificExecutor
&& ((InternalMayRequireSpecificExecutor)creds).isSpecificExecutorRequired()
&& callOptions.getExecutor() != null) {
executor = callOptions.getExecutor();
} else {
executor = appExecutor;
}

creds.applyRequestMetadata(requestInfo, executor, applier);
} catch (Throwable t) {
applier.fail(Status.UNAUTHENTICATED
.withDescription("Credentials should use fail() instead of throwing exceptions")
2 changes: 1 addition & 1 deletion core/src/main/java/io/grpc/internal/GrpcUtil.java
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ public byte[] parseAsciiString(byte[] serialized) {

public static final Splitter ACCEPT_ENCODING_SPLITTER = Splitter.on(',').trimResults();

private static final String IMPLEMENTATION_VERSION = "1.49.0"; // CURRENT_GRPC_VERSION
private static final String IMPLEMENTATION_VERSION = "1.49.1"; // CURRENT_GRPC_VERSION

/**
* The default timeout in nanos for a keepalive ping request.
Loading