Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

//grpclb:grpclb Bazel target missing META-INF resources #9149

Closed
SanjayVas opened this issue May 6, 2022 · 7 comments · Fixed by #9156
Closed

//grpclb:grpclb Bazel target missing META-INF resources #9149

SanjayVas opened this issue May 6, 2022 · 7 comments · Fixed by #9156
Milestone

Comments

@SanjayVas
Copy link

SanjayVas commented May 6, 2022

What version of gRPC-Java are you using?

1.46.0

What is your environment?

Linux (Debian Bookworm / gLinux), JDK 11, Bazel 4.2.1

What did you expect to see?

Generated JAR from //grpclb:grpclb target includes resources under META-INF/services like how the Maven JAR does.

What did you see instead?

JAR does not include these files.

Steps to reproduce the bug

  1. Depend on grpc-java as a Bazel repo using /repositories.bzl
  2. Depend on google-cloud-spanner Maven artifact.
  3. Attempt to connect to Google Cloud Spanner.
com.google.cloud.spanner.SpannerException: UNKNOWN: Default config is invalid: Status{code=UNKNOWN, description=None of [grpclb] specified by Service Config are available., cause=null}
        at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerExceptionPreformatted(SpannerExceptionFactory.java:284)
        at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:61)
        at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:181)
        at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:110)
        at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.<init>(GapicSpannerRpc.java:517)
        at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.<init>(GapicSpannerRpc.java:302)
        at com.google.cloud.spanner.SpannerOptions$DefaultSpannerRpcFactory.create(SpannerOptions.java:469)
        at com.google.cloud.spanner.SpannerOptions$DefaultSpannerRpcFactory.create(SpannerOptions.java:464)
        at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:560)
        at com.google.cloud.spanner.SpannerOptions.getSpannerRpcV1(SpannerOptions.java:1320)
        at com.google.cloud.spanner.SpannerImpl.<init>(SpannerImpl.java:132)
        at com.google.cloud.spanner.SpannerOptions$DefaultSpannerFactory.create(SpannerOptions.java:459)
        at com.google.cloud.spanner.SpannerOptions$DefaultSpannerFactory.create(SpannerOptions.java:454)
        at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:540)

...

Caused by: java.lang.IllegalStateException: Default config is invalid: Status{code=UNKNOWN, description=None of [grpclb] specified by Service Config are available., cause=null}
        at com.google.common.base.Preconditions.checkState(Preconditions.java:590)
        at io.grpc.internal.ManagedChannelImpl.<init>(ManagedChannelImpl.java:676)
        at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:630)
        at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:297)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:388)
        at com.google.api.gax.grpc.ChannelPool.<init>(ChannelPool.java:105)
        at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:83)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:236)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:230)
        at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:201)
        at com.google.cloud.spanner.v1.stub.GrpcSpannerStub.create(GrpcSpannerStub.java:231)
        at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.<init>(GapicSpannerRpc.java:411)
        ... 32 more

Notes

Due to missing the above files, the default LoadBalancerRegistry is unable to find a load balancer for grpclb.

SanjayVas added a commit to world-federation-of-advertisers/common-jvm that referenced this issue May 6, 2022
This updates Spanner dependencies to latest versions, including a workaround for grpc/grpc-java#9149.
SanjayVas added a commit to world-federation-of-advertisers/common-jvm that referenced this issue May 6, 2022
This also updates related dependencies, including a workaround for grpc/grpc-java#9149.
SanjayVas added a commit to world-federation-of-advertisers/common-jvm that referenced this issue May 6, 2022
This updates Spanner dependencies to latest versions, including a workaround for grpc/grpc-java#9149.
SanjayVas added a commit to world-federation-of-advertisers/common-jvm that referenced this issue May 9, 2022
This also updates related dependencies, including a workaround for grpc/grpc-java#9149.
@sergiitk
Copy link
Member

@SanjayVas Thank you for the report. To clarify, is this something that started to occur recently, or something we were missing all along?

@SanjayVas
Copy link
Author

I think that it's something that was only surfaced by a change when we upgraded https://github.com/googleapis/java-spanner, as we had been using a very old version (3.0.3). Prior to that, I don't think we were using any client libraries that tried to use grpclb.

@sergiitk
Copy link
Member

@SanjayVas Fixed with #9156.

@sergiitk sergiitk added this to the v1.47 milestone May 10, 2022
@sergiitk
Copy link
Member

@SanjayVas To clarify one thing: would you like me to backport this change to previous versions?

@SanjayVas
Copy link
Author

For my project in particular, we have a workaround and are fine just dropping that once we upgrade to a release that has this fix.

I don't know what the backporting policy should be here. AFAICT, the bug is only surfaced when the following conditions are all true:

  1. Building grpc-java grpclb using Bazel (as opposed to pulling it from Maven).
  2. Using a client library that specifies the grpclb policy.

We only hit (2) after upgrading java-spanner, which I assume in turn picked up something related to grpclb policy from gax-java. I'm not sure which versions of grpc-java you'd want to backport this to as a result.

As an aside, the particularly insidious thing is that we only hit the error when attempting to connect to a real Cloud Spanner instance. All of our tests using Spanner Emulator don't hit this path.

@sergiitk sergiitk modified the milestones: v1.47, Next May 12, 2022
@sergiitk
Copy link
Member

Building grpc-java grpclb using Bazel (as opposed to pulling it from Maven).

Yes, I verified that maven jars do have this files, and bazel builds didn't. Then I fixed bazel builds in #9156.

I don't know what the backporting policy should be here.

I personally don't know how bazel-oriented users set up grpc-java dependencies. Is it pinned to a version tag, f.e. v1.46.0? Or a version branch, v1.46.x? Whatever the case, I'll be happy to backport that change if you have a practical need for it.

cc @ejona86

@ejona86
Copy link
Member

ejona86 commented May 12, 2022

@sergiitk, let's backport the change, but we don't need to bother yet with making a patch release for it.

@ejona86 ejona86 modified the milestones: Next, v1.47 May 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants