build: drop the gRPC transport that google-cloud-storage never uses here - #3415
Merged
Merged
Conversation
GcsStorageClient builds its client with StorageOptions.newBuilder(), which is the JSON over HTTP transport. The gRPC one is reachable only through StorageOptions.grpc(), which nothing calls, but google-cloud-storage declares the dependencies of both, so the distribution carried the whole gRPC stack: 29 jars, 26.4 MiB, of which grpc-xds and grpc-netty-shaded are 21 MiB between them. The exclusion block is the same one as codelibs/fess-crawler#200. Fess declares google-cloud-storage directly, so the exclusions there do not reach it. Three things stay because removing them breaks the JSON transport: io.grpc:grpc-api, which holds io.grpc.Context that OpenCensus needs on every request; proto-google-cloud-storage-v2, which JsonConversions decodes bucket names with; and the OpenTelemetry api, context and common jars, which gax-httpjson uses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to codelibs/fess-crawler#200. Fess declares
google-cloud-storagedirectly, sothe exclusions there do not reach it; the block here is the same one.
Why
GcsStorageClientbuilds its client withStorageOptions.newBuilder()— theJSON-over-HTTP transport. The gRPC one is reachable only through
StorageOptions.grpc(),which nothing calls, but
google-cloud-storagedeclares the dependencies of both.Distribution zip: 218.9 MiB → 194.2 MiB (−24.7 MiB). 29 jars out, nothing in;
grpc-xds(10.5 MiB) andgrpc-netty-shaded(10.3 MiB) are most of it.After the change the war holds exactly two
io.grpcjars, both deliberate:and no
opentelemetry-sdk-*orgoogle-cloud-monitoring.Three things deliberately kept
io.grpc:grpc-apiHttpStorageRpc#startSpanopens an OpenCensus span on every request; OpenCensus keeps its span inio.grpc.Context, which has lived ingrpc-apisince gRPC 1.60.proto-google-cloud-storage-v2JsonConversions#bucketInfoDecodeusescom.google.storage.v2.BucketName.opentelemetry-api,-context,-commongax-httpjsonuses them.Both of the first two were found by running fess-crawler's live GCS tests, not by reading
the dependency tree — excluding them compiles clean and then throws
NoClassDefFoundErroron the first call. Details and stack traces are in codelibs/fess-crawler#200.
The OpenTelemetry SDK and the generated gRPC client are safe because, reading the constant
pools of
google-cloud-storage-2.71.0.jar, the only class referencingio/opentelemetry/sdkis
OpenTelemetryBootstrappingUtils, whose only caller in the jar isGrpcStorageOptions.Verification, and its limit
mvn package→BUILD SUCCESS; jar inventory and zip size as above.GcsClientTestagainstfsouza/fake-gcs-server, on the samegoogle-cloud-storageversion with the same exclusions.
GcsStorageClientTesthere is a stub-based unit test and does not touch the network.I could not exercise
GcsStorageClientagainst a live server, and the reason is aseparate pre-existing defect on master, not this change. Constructing the client throws
before it makes any request:
google-cloud-storage2.71.0 needsgoogle-http-client2.x; fess-parent pinsgoogle.http.client.versionat1.47.0and this pom declaresgoogle-http-client,-jackson2and-xmlat that version directly, so the direct declaration wins over the2.2.0 the storage client asks for.
grep google-http-clientover the shipped war confirmsit:
google-http-client-1.47.0.jarnext togoogle-cloud-storage-2.71.0.jar.I reproduced the same failure with an unmodified
pom.xml, so it predates this PR and thisPR neither causes nor fixes it. It needs its own change — the bump is
google-http-client1.x → 2.x, which also affects
OpenIdConnectAuthenticatorandfess-ds-gsuite, so it wantsits own verification rather than being folded in here.