quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.56k stars 2.62k forks source link

Quarkus with GRPC extension fails to build on Alpine Linux #42716

Open andreiyusupau opened 3 weeks ago

andreiyusupau commented 3 weeks ago

Describe the bug

I'm running into following exception when trying to run gradle build on simple Quarkus app using grpc plugin:

Task :quarkusGenerateCode
terminate called after throwing an instance of 'std::system_error'
what():  No error information
--grpc_out: protoc-gen-grpc: Plugin killed by signal 6.

Expected behavior

Like in Quarkus 3.10.0 project builds fine.

Actual behavior

In Quarkus 3.13.3 build fails.

How to Reproduce?

Create a sample app with grpc extension using gradle via https://code.quarkus.io. Put the following Dockerfile into a project folder and run docker build . :

FROM docker:27.1.2

RUN apk update
RUN apk upgrade
RUN apk add curl bash gcompat libstdc++
RUN apk add openjdk21
RUN apk add gradle
RUN curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
COPY . .
RUN gradle build --no-daemon

CMD ["tail", "-f", "/dev/null"]

P.S. In reality I encounter this error when using Gitlab pipelines, this Dockerfile just emulates it's behavior.

Output of uname -a or ver

No response

Output of java -version

21.0.4

Quarkus version or git rev

3.13.3

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

gradle 8.7

Additional information

I've checked this issue https://github.com/quarkusio/quarkus/issues/13773 and if it's bug with protoc versions like stated here any suggestions on fixing dependencies or using custom protoc would be also great :) Guide (https://quarkus.io/guides/grpc-getting-started) says about special property to specify custom protoc implementation -Dquarkus.grpc.protoc-path=/path/to/protoc., but I didn't understand if it suites for gradle or it's only solution for quarkus-maven-plugin.

quarkus-bot[bot] commented 3 weeks ago

/cc @alesj (grpc), @cescoffier (grpc), @maxandersen (jbang), @quarkusio/devtools (jbang)

cescoffier commented 3 weeks ago

Does protoc work on Alpline?

(In general, I do not recommend Alpine; UBI should work)

andreiyusupau commented 3 weeks ago

@cescoffier it worked fine with Quarkus 3.10.0. Also as I can see official Docker image has only Alpine-based distributions.

cescoffier commented 2 weeks ago

We had to update protoc because of CVE. The new version has new native dependencies. Try installing protoc directly and see if it works, I believe it won't.

andreiyusupau commented 1 week ago

I've updated my Dockerfile to use local protoc installation:

FROM docker:27.1.2

RUN apk update
RUN apk upgrade
RUN apk add curl bash
RUN apk add gradle
RUN apk add protoc
RUN curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
COPY . .

RUN gradle build -Dquarkus.grpc.protoc-path=/usr/bin/protoc

CMD ["tail", "-f","/dev/null"]

But it seems that parameter -Dquarkus.grpc.protoc-path doesn't work, because I'm getting the following error:

84.53 > Task :quarkusGenerateCode
109.5 
109.5 /build/io.grpc-protoc-gen-grpc-java-linux-x86_64-exe: program not found or is not executable
109.5 Please specify a program using absolute path or make sure the program is available in your PATH system variable
109.5 --grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
109.5 
109.5 > Task :quarkusGenerateCode FAILED
109.5 
109.5 FAILURE: Build failed with an exception.

Is there a way to specify local protoc to be used in gradle build process?

cescoffier commented 1 week ago

You need https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.38.0/.

andreiyusupau commented 1 week ago

Usage of https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.38.0/ (along with this plugin to execute the proto files compilation https://github.com/google/protobuf-gradle-plugin) together with with Quarkus leads to this issue: https://github.com/google/protobuf-gradle-plugin/issues/659