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

[secretmanager] Failed to instantiate SecretManagerServiceClient in Java client library #11373

Open
thagikura opened this issue Jan 1, 2025 · 5 comments
Labels
api: secretmanager Issues related to the Secret Manager API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@thagikura
Copy link

thagikura commented Jan 1, 2025

When I tried to instantiate SecretManagerServiceClient in the java client library, an Exception was thrown in the protobuf layer.
I couldn't instantiate the client because of the error.

Environment details

  1. Specify the API at the beginning of the title. For example, "[vision]: ...").
    SecretManager

  2. OS type and version:
    macOS Sequoia 15.1.1

  3. Java version:
    17

  4. Version(s):
    google-cloud-bom: 26.51.0
    (derived version from bom) com.google.cloud:google-cloud-secretmanager:2.54.0
    Kotlin version: 2.1.0

Steps to reproduce

  1. Instantiate SecretManagerServiceClient

Code example

import com.google.cloud.secretmanager.v1.SecretManagerServiceClient

val client = SecretManagerServiceClient.create()

Stack trace

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/google/longrunning/Operation.mergeMetadata(Lcom/google/protobuf/Any;)V @31: invokevirtual
  Reason:
    Type 'com/google/protobuf/Any' (current frame, stack[2]) is not assignable to 'com/google/protobuf/GeneratedMessageLite'
  Current Frame:
    bci: @31
    flags: { }
    locals: { 'com/google/longrunning/Operation', 'com/google/protobuf/Any' }
    stack: { 'com/google/longrunning/Operation', 'com/google/protobuf/Any$Builder', 'com/google/protobuf/Any' }
  Bytecode:
    0000000: 2bb6 0018 572a b400 1dc6 0028 2ab4 001d
    0000010: b800 1ea5 001e 2a2a b400 1db8 001f 2bb6
    0000020: 0020 c000 21b6 0022 c000 23b5 001d a700
    0000030: 082a 2bb5 001d b1                      
  Stackmap Table:
    same_frame(@49)
    same_frame(@54)

	at com.google.longrunning.stub.GrpcOperationsStub.<clinit>(GrpcOperationsStub.java:69)
	at com.google.cloud.secretmanager.v1.stub.GrpcSecretManagerServiceStub.<init>(GrpcSecretManagerServiceStub.java:284)
	at com.google.cloud.secretmanager.v1.stub.GrpcSecretManagerServiceStub.<init>(GrpcSecretManagerServiceStub.java:270)
	at com.google.cloud.secretmanager.v1.stub.GrpcSecretManagerServiceStub.create(GrpcSecretManagerServiceStub.java:248)
	at com.google.cloud.secretmanager.v1.stub.SecretManagerServiceStubSettings.createStub(SecretManagerServiceStubSettings.java:359)
	at com.google.cloud.secretmanager.v1.SecretManagerServiceClient.<init>(SecretManagerServiceClient.java:455)
	at com.google.cloud.secretmanager.v1.SecretManagerServiceClient.create(SecretManagerServiceClient.java:437)
	at com.google.cloud.secretmanager.v1.SecretManagerServiceClient.create(SecretManagerServiceClient.java:428)

External references such as API reference guides

Any additional information below

I tried both
import com.google.cloud.secretmanager.v1beta2.SecretManagerServiceClient and
import com.google.cloud.secretmanager.v1.SecretManagerServiceClient

but resulted in the same error.

@suztomo
Copy link
Member

suztomo commented Jan 1, 2025

Thank you for the report. That "GeneratedMessageLite" having the suffix "Lite" is suspicious to me. Protobuf Lite is for special runtime environments.

Would you share the followings?

  • the dependency graph (gradlew dependencies for Maven; mvn dependency:tree)
  • A simple project that reproduces the problem

@mpeddada1 mpeddada1 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. api: secretmanager Issues related to the Secret Manager API. labels Jan 3, 2025
@suztomo
Copy link
Member

suztomo commented Jan 9, 2025

@thagikura I'll close this issue if there's no activity.

@thagikura
Copy link
Author

Sorry for the delayed response.

When I created a minimal project to try to reproduce the issue, I couldn't reproduce that issue in that project.

Here is the minimal project that instantiates the SecretMangerServiceClient. (It requires Application Default Credentials to run, but it succeeds to instantiate the SecretManagerServiceClient)

And here is the result of ./gradlew dependencies in that minimal project.

(Extracted only the compileClasspath part)

compileClasspath - Compile classpath for 'main'.
+--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0
|    \--- org.jetbrains:annotations:13.0
+--- com.google.cloud:libraries-bom:26.51.0
|    +--- com.google.cloud:google-cloud-secretmanager:2.54.0 (c)
|    +--- io.grpc:grpc-api:1.68.1 (c)
|    +--- io.grpc:grpc-stub:1.68.1 (c)
|    +--- io.grpc:grpc-protobuf:1.68.1 (c)
|    +--- com.google.api:api-common:2.41.0 (c)
|    +--- com.google.auto.value:auto-value-annotations:1.11.0 (c)
|    +--- com.google.protobuf:protobuf-java:4.28.3 (c)
|    +--- com.google.api.grpc:proto-google-common-protos:2.49.0 (c)
|    +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1beta2:2.54.0 (c)
|    +--- com.google.api.grpc:proto-google-iam-v1:1.44.0 (c)
|    +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1:2.54.0 (c)
|    +--- com.google.guava:guava:33.3.1-jre (c)
|    +--- com.google.api:gax:2.58.0 (c)
|    +--- com.google.auth:google-auth-library-credentials:1.30.0 (c)
|    +--- io.grpc:grpc-context:1.68.1 (c)
|    +--- com.google.auth:google-auth-library-oauth2-http:1.30.0 (c)
|    +--- com.google.api:gax-grpc:2.58.0 (c)
|    +--- io.grpc:grpc-inprocess:1.68.1 (c)
|    +--- io.grpc:grpc-core:1.68.1 (c)
|    +--- io.grpc:grpc-alts:1.68.1 (c)
|    +--- io.grpc:grpc-grpclb:1.68.1 (c)
|    +--- io.grpc:grpc-auth:1.68.1 (c)
|    +--- io.grpc:grpc-s2a:1.68.1 (c)
|    +--- io.grpc:grpc-netty-shaded:1.68.1 (c)
|    +--- com.google.api:gax-httpjson:2.58.0 (c)
|    +--- com.google.code.gson:gson:2.11.0 (c)
|    +--- com.google.http-client:google-http-client:1.45.0 (c)
|    +--- com.google.http-client:google-http-client-gson:1.45.0 (c)
|    \--- com.google.protobuf:protobuf-java-util:4.28.3 (c)
\--- com.google.cloud:google-cloud-secretmanager -> 2.54.0
     +--- io.grpc:grpc-api:1.68.1
     +--- com.google.code.findbugs:jsr305:3.0.2
     +--- com.google.errorprone:error_prone_annotations:2.35.1
     +--- io.grpc:grpc-stub:1.68.1
     +--- io.grpc:grpc-protobuf:1.68.1
     +--- com.google.api:api-common:2.41.0
     +--- com.google.auto.value:auto-value-annotations:1.11.0
     +--- javax.annotation:javax.annotation-api:1.3.2
     +--- com.google.j2objc:j2objc-annotations:3.0.0
     +--- com.google.protobuf:protobuf-java:3.25.5 -> 4.28.3
     +--- com.google.api.grpc:proto-google-common-protos:2.49.0
     +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1beta2:2.54.0
     |    +--- com.google.auto.value:auto-value-annotations:1.11.0
     |    +--- com.google.code.findbugs:jsr305:3.0.2
     |    +--- javax.annotation:javax.annotation-api:1.3.2
     |    +--- com.google.errorprone:error_prone_annotations:2.35.1
     |    +--- com.google.j2objc:j2objc-annotations:3.0.0
     |    +--- com.google.guava:failureaccess:1.0.2
     |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     |    \--- org.checkerframework:checker-qual:3.47.0
     +--- com.google.api.grpc:proto-google-iam-v1:1.44.0
     +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1:2.54.0
     |    +--- com.google.guava:failureaccess:1.0.2
     |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     |    +--- com.google.code.findbugs:jsr305:3.0.2
     |    +--- org.checkerframework:checker-qual:3.47.0
     |    +--- com.google.errorprone:error_prone_annotations:2.35.1
     |    +--- com.google.j2objc:j2objc-annotations:3.0.0
     |    +--- com.google.auto.value:auto-value-annotations:1.11.0
     |    \--- javax.annotation:javax.annotation-api:1.3.2
     +--- com.google.guava:guava:33.3.1-jre
     +--- com.google.guava:failureaccess:1.0.2
     +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     +--- org.checkerframework:checker-qual:3.47.0
     +--- com.google.api:gax:2.58.0
     +--- com.google.auth:google-auth-library-credentials:1.30.0
     +--- io.opencensus:opencensus-api:0.31.1
     +--- io.grpc:grpc-context:1.68.1
     +--- com.google.auth:google-auth-library-oauth2-http:1.30.0
     +--- com.google.api:gax-grpc:2.58.0
     +--- io.grpc:grpc-inprocess:1.68.1
     +--- io.grpc:grpc-core:1.68.1
     +--- io.grpc:grpc-alts:1.68.1
     +--- io.grpc:grpc-grpclb:1.68.1
     +--- org.conscrypt:conscrypt-openjdk-uber:2.5.2
     +--- io.grpc:grpc-auth:1.68.1
     +--- io.grpc:grpc-s2a:1.68.1
     +--- io.grpc:grpc-netty-shaded:1.68.1
     +--- com.google.api:gax-httpjson:2.58.0
     +--- com.google.code.gson:gson:2.11.0
     +--- com.google.http-client:google-http-client:1.45.0
     +--- org.apache.httpcomponents:httpclient:4.5.14
     +--- commons-codec:commons-codec:1.17.1
     +--- org.apache.httpcomponents:httpcore:4.4.16
     +--- io.opencensus:opencensus-contrib-http-util:0.31.1
     +--- com.google.http-client:google-http-client-gson:1.45.0
     +--- com.google.protobuf:protobuf-java-util:3.25.5 -> 4.28.3
     \--- org.threeten:threetenbp:1.7.0

The instantiation issue still happens in my production repository, but I still couldn't manage to extract it to a minimal reproducible project.

For the reference here is the result of ./gradlew <module-that-use-cloud-secretmanager-in-production>:dependencies

allSourceSetsCompileDependenciesMetadata
+--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0
+--- org.slf4j:slf4j-api:2.0.16
+--- ch.qos.logback:logback-classic:1.4.14
|    +--- ch.qos.logback:logback-core:1.4.14
|    \--- org.slf4j:slf4j-api:2.0.7 -> 2.0.16
+--- ch.qos.logback:logback-core:1.4.14
+--- co.touchlab:kermit:2.0.5
|    +--- co.touchlab:kermit-core:2.0.5
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.1.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.1.0
+--- project :core:config
|    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0
+--- com.google.cloud:libraries-bom:26.51.0
|    +--- com.google.cloud:google-cloud-secretmanager:2.54.0 (c)
|    +--- io.grpc:grpc-api:1.68.1 (c)
|    +--- io.grpc:grpc-stub:1.68.1 (c)
|    +--- io.grpc:grpc-protobuf:1.68.1 (c)
|    +--- com.google.api:api-common:2.41.0 (c)
|    +--- com.google.auto.value:auto-value-annotations:1.11.0 (c)
|    +--- com.google.protobuf:protobuf-java:4.28.3 (c)
|    +--- com.google.api.grpc:proto-google-common-protos:2.49.0 (c)
|    +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1beta2:2.54.0 (c)
|    +--- com.google.api.grpc:proto-google-iam-v1:1.44.0 (c)
|    +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1:2.54.0 (c)
|    +--- com.google.guava:guava:33.3.1-jre (c)
|    +--- com.google.api:gax:2.58.0 (c)
|    +--- com.google.auth:google-auth-library-credentials:1.30.0 (c)
|    +--- io.grpc:grpc-context:1.68.1 (c)
|    +--- com.google.auth:google-auth-library-oauth2-http:1.30.0 (c)
|    +--- com.google.api:gax-grpc:2.58.0 (c)
|    +--- io.grpc:grpc-inprocess:1.68.1 (c)
|    +--- io.grpc:grpc-core:1.68.1 (c)
|    +--- io.grpc:grpc-alts:1.68.1 (c)
|    +--- io.grpc:grpc-grpclb:1.68.1 (c)
|    +--- io.grpc:grpc-auth:1.68.1 (c)
|    +--- io.grpc:grpc-s2a:1.68.1 (c)
|    +--- io.grpc:grpc-netty-shaded:1.68.1 (c)
|    +--- com.google.api:gax-httpjson:2.58.0 (c)
|    +--- com.google.code.gson:gson:2.11.0 (c)
|    +--- com.google.http-client:google-http-client:1.45.0 (c)
|    +--- com.google.http-client:google-http-client-gson:1.45.0 (c)
|    \--- com.google.protobuf:protobuf-java-util:4.28.3 (c)
\--- com.google.cloud:google-cloud-secretmanager -> 2.54.0
     +--- io.grpc:grpc-api:1.68.1
     +--- com.google.code.findbugs:jsr305:3.0.2
     +--- com.google.errorprone:error_prone_annotations:2.35.1
     +--- io.grpc:grpc-stub:1.68.1
     +--- io.grpc:grpc-protobuf:1.68.1
     +--- com.google.api:api-common:2.41.0
     +--- com.google.auto.value:auto-value-annotations:1.11.0
     +--- javax.annotation:javax.annotation-api:1.3.2
     +--- com.google.j2objc:j2objc-annotations:3.0.0
     +--- com.google.protobuf:protobuf-java:3.25.5 -> 4.28.3
     +--- com.google.api.grpc:proto-google-common-protos:2.49.0
     +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1beta2:2.54.0
     |    +--- com.google.auto.value:auto-value-annotations:1.11.0
     |    +--- com.google.code.findbugs:jsr305:3.0.2
     |    +--- javax.annotation:javax.annotation-api:1.3.2
     |    +--- com.google.errorprone:error_prone_annotations:2.35.1
     |    +--- com.google.j2objc:j2objc-annotations:3.0.0
     |    +--- com.google.guava:failureaccess:1.0.2
     |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     |    \--- org.checkerframework:checker-qual:3.47.0
     +--- com.google.api.grpc:proto-google-iam-v1:1.44.0
     +--- com.google.api.grpc:proto-google-cloud-secretmanager-v1:2.54.0
     |    +--- com.google.guava:failureaccess:1.0.2
     |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     |    +--- com.google.code.findbugs:jsr305:3.0.2
     |    +--- org.checkerframework:checker-qual:3.47.0
     |    +--- com.google.errorprone:error_prone_annotations:2.35.1
     |    +--- com.google.j2objc:j2objc-annotations:3.0.0
     |    +--- com.google.auto.value:auto-value-annotations:1.11.0
     |    \--- javax.annotation:javax.annotation-api:1.3.2
     +--- com.google.guava:guava:33.3.1-jre
     +--- com.google.guava:failureaccess:1.0.2
     +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
     +--- org.checkerframework:checker-qual:3.47.0
     +--- com.google.api:gax:2.58.0
     +--- com.google.auth:google-auth-library-credentials:1.30.0
     +--- io.opencensus:opencensus-api:0.31.1
     +--- io.grpc:grpc-context:1.68.1
     +--- com.google.auth:google-auth-library-oauth2-http:1.30.0
     +--- com.google.api:gax-grpc:2.58.0
     +--- io.grpc:grpc-inprocess:1.68.1
     +--- io.grpc:grpc-core:1.68.1
     +--- io.grpc:grpc-alts:1.68.1
     +--- io.grpc:grpc-grpclb:1.68.1
     +--- org.conscrypt:conscrypt-openjdk-uber:2.5.2
     +--- io.grpc:grpc-auth:1.68.1
     +--- io.grpc:grpc-s2a:1.68.1
     +--- io.grpc:grpc-netty-shaded:1.68.1
     +--- com.google.api:gax-httpjson:2.58.0
     +--- com.google.code.gson:gson:2.11.0
     +--- com.google.http-client:google-http-client:1.45.0
     +--- org.apache.httpcomponents:httpclient:4.5.14
     +--- commons-codec:commons-codec:1.17.1
     +--- org.apache.httpcomponents:httpcore:4.4.16
     +--- io.opencensus:opencensus-contrib-http-util:0.31.1
     +--- com.google.http-client:google-http-client-gson:1.45.0
     +--- com.google.protobuf:protobuf-java-util:3.25.5 -> 4.28.3
     \--- org.threeten:threetenbp:1.7.0

Do you have any ideas from what I'm observing?

@suztomo
Copy link
Member

suztomo commented Jan 9, 2025

An java.lang.VerifyError has occurred in the past #10698 and it seems related to the operating system. Did you try running it in the same Docker container or VM image?

@thagikura
Copy link
Author

Yes, both of them were running on the same Mac PC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: secretmanager Issues related to the Secret Manager API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants