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

grpc-server gets deactivated if no proto file and corresponging implementation is present #41861

Closed
ncabanis opened this issue Jul 12, 2024 · 11 comments
Labels
area/grpc gRPC kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.

Comments

@ncabanis
Copy link

Describe the bug

If both extensions "grpc" and "kotlin" are active, then when running the application in non-dev-mode, the feature "grpc-server" is missing. In dev-mode, it works.

Expected behavior

grpc and kotlin should work together also in production mode

Actual behavior

No response

How to Reproduce?

code-with-quarkus.zip

  1. create the app with gRPC, Rest and Kotlin, using Gradle Kotlin DSL
    e.g: https://code.quarkus.io/?b=GRADLE_KOTLIN_DSL&e=grpc&e=rest&e=kotlin
  2. ./gradlew quarkusBuild
  3. java -jar build/quarkus-app/quarkus-run.jar
  4. observe in installed features, grpc-server is missing:
    Installed features: [cdi, kotlin, rest, smallrye-context-propagation, vertx]

by the way: ./gradlew quarkusRun also does not work

Output of uname -a or ver

Darwin ADC-MB20046 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "21" 2023-09-19 OpenJDK Runtime Environment Zulu21.28+85-CA (build 21+35) OpenJDK 64-Bit Server VM Zulu21.28+85-CA (build 21+35, mixed mode, sharing)

Quarkus version or git rev

3.12.2

Build tool (ie. output of mvnw --version or gradlew --version)

❯ ./gradlew --version ------------------------------------------------------------ Gradle 8.8 ------------------------------------------------------------ Build time: 2024-05-31 21:46:56 UTC Revision: 4bd1b3d3fc3f31db5a26eecb416a165b8cc36082 Kotlin: 1.9.22 Groovy: 3.0.21 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21 (Azul Systems, Inc. 21+35) OS: Mac OS X 14.5 aarch64

Additional information

No response

@ncabanis ncabanis added the kind/bug Something isn't working label Jul 12, 2024
Copy link

quarkus-bot bot commented Jul 12, 2024

/cc @alesj (grpc), @cescoffier (grpc), @geoand (kotlin)

@cescoffier
Copy link
Member

Do you have a gRPC service defined?

In dev mode we always run the gRPc server (for the reflection service), but because this service is disabled by default in production mode, the gRPC server may disable itself as there are no services to serve.

@ncabanis
Copy link
Author

Yes, I have a service annotated with io.quarkus.grpc.GrpcService included.
In the dev-ui, it is also listed here: http://localhost:8080/q/dev-ui/io.quarkus.quarkus-grpc/services
But the proto file is not within this project, but externally defined.

@ncabanis
Copy link
Author

I also tried: if I remove the Kotlin extension, then it works as expected.
(I generated plain starters with different features selected.)

@ncabanis
Copy link
Author

The IDE also complains about "Kotlin not configured".
Even though the Kotlin editing, running etc. seems to work normally.
image

@ncabanis
Copy link
Author

Hmm, I tried again my project now without Kotlin and it does not work. Maybe I was wrong in the assumption that there is a connection.

@ncabanis
Copy link
Author

I narrowed it down. For the grpc-feature to be active, a proto file must be there as well as an implementation of that service. If one is missing, then, its getting deactivated.

This took me several hours today. Would be nice to have at least a DEBUG log, if such magic happens.

@ncabanis ncabanis changed the title Extension grpc-server incompatible with kotlin grpc-server gets deactivated if no proto file and corresponging implementation is present Jul 12, 2024
@cescoffier
Copy link
Member

Wondering why it does not find the service in that case. I would say it's a bug.

@cescoffier
Copy link
Member

Does your dependency contains not only the proto file but also the generated code. If that's the case that's actually the expected behavior.

We recommend to either:

  • jandex your dependency or force indexing in Quarkus
  • configure Quarkus gRPC to re-generate the generated files from the proto file

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Jul 15, 2024
@geoand
Copy link
Contributor

geoand commented Aug 5, 2024

Closing for lack of feedback.

If the requested information becomes available, we can reopen

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
@ncabanis
Copy link
Author

The proto files and the generated code is contained in this jar: opentelemetry-proto-1.3.1-alpha.jar

About your recommendations: if I re-generate the code, I would end up with the same classes multiple times on the classpath, which is probably not the best idea.

How do I force indexing in Quarkus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

No branches or pull requests

3 participants