quarkiverse / quarkus-google-cloud-services

Google Cloud Services Quarkus Extensions

Home Page:https://docs.quarkiverse.io/quarkus-google-cloud-services/main/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Native executable compiled with GraalVM fails to subscribe to Google Pub/Sub topic

gpaolopedrazza opened this issue · comments

I create a new Google Pub/Sub project for Quarkus following exactly the tutorial available on https://docs.quarkiverse.io/quarkus-google-cloud-services/main/pubsub.html using 3.2.0 Final as quarkus version. The only small difference was in the subscription name, because I already had one and therefore, I just used it like
ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectId, pubSubSubscription);
Running the project on quarkus works like a charm, the subscriber works and messages are sent/received to/from the Pub/Sub subscription.
My problem comes when I try to build a native executable. I downloaded and installed Oracle GraalVM 20.0.2+9.1 and tried to build a native image.
mvnw --no-transfer-progress -f pom.xml -Pnative clean package -DskipTest
Due to following bug in GraalVM oracle/graal#5868, I had to implement following workaround apache/camel-quarkus#5006 (comment)
Probably precisely because of that GraalVM bug, Google Pub/Sub rejects the subscriber request with invalid argument error.
However, the log entries show no difference between the request sent by the executable binary and the request sent by quarkus.
Is this really just a bug of GraalVM and I have to wait for the fix? Is there any different method/framework else I can use in order to make a PubSub subscriber working under Quarkus with a native build?

How to Reproduce?

  1. Follow the tutorial https://docs.quarkiverse.io/quarkus-google-cloud-services/main/pubsub.html and check the project works in quarkus
  2. Install Oracle GraalVM 20.0.2+9.1 and build an executable
  3. Try to run the executable

Output of java -version
java 20.0.1 2023-04-18

GraalVM version (if different from Java)
20.0.2+9.1

Quarkus version or git rev
3.2.1

Build tool (ie. output of mvnw --version or gradlew --version)
mvnw --version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Java version: 20.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\graalvm-jdk-20_windows-x64_bin\graalvm-jdk-20.0.2+9.1
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

This is probably fixed by 0f223ba which updates the google cloud sdk which no longer passes -H:-RunReachabilityHandlersConcurrently to native-image (see googleapis/sdk-platform-java#1344)

cc @loicmathieu

I'll check the reproducer with the newly published version.

Using Google Cloud Services version 2.5.0 which will be part of the very soon to be released Quarkus 3.4 platform the reproducer now compiles to native.

@loicmathieu well, this was not just about successful compiling the native, the real issue for me was this error message I got running the binary with the workaround
2023-09-07 15:46:19,591 SEVERE [com.goo.clo.pub.v1.StreamingSubscriberConnection] (Subscriber-SE-1-0) terminated streaming with exception: com.google.api.gax.rpc.InvalidArgumentException: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Request contains an invalid argument.
Have you also tried to launch the binary? Have you got any error message? Which GralVM version are you using?