quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

gRPC codegen fails for large file name like io.envoyproxy.controlplane:api on windows

Open ls-bit opened this issue 1 year ago • 5 comments

Describe the bug

I stumbled upon this problem while testing envoy control plane api.

gRPC codegen fails with an exception when adding quarkus.generate-code.grpc.scan-for-proto=io.envoyproxy.controlplane:api to scan envoy controlplane api for proto files.

Caused by: io.quarkus.bootstrap.prebuild.CodeGenException: Failed to generate java files from proto file in C:\test\code-with-quarkus\build\classes\java\quarkus-generated-sources\proto\.
        at io.quarkus.grpc.deployment.GrpcCodeGen.trigger(GrpcCodeGen.java:177)
        at io.quarkus.deployment.CodeGenerator.lambda$trigger$4(CodeGenerator.java:204)
        at io.quarkus.deployment.CodeGenerator.callWithClassloader(CodeGenerator.java:179)
        at io.quarkus.deployment.CodeGenerator.trigger(CodeGenerator.java:201)
        at io.quarkus.deployment.CodeGenerator.initAndRun(CodeGenerator.java:78)
        ... 28 more
Caused by: java.io.IOException: Cannot run program "C:\test\code-with-quarkus\build\com.google.protobuf-protoc-windows-x86_64-exe": CreateProcess error=206, The filename or extension is too long
        at io.quarkus.deployment.util.ProcessUtil.launchProcess(ProcessUtil.java:38)
        at io.quarkus.grpc.deployment.GrpcCodeGen.trigger(GrpcCodeGen.java:165)
        ... 32 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long

Probably only an issue on windows, as it builds fine on a WSL Ubuntu VM.

Note that the io.envoyproxy.controlplane:api artifact also contains generated code, so it is possible to use the code from the artifact.

Expected behavior

No exception occurs

Actual behavior

java.io.IOException: CreateProcess error=206, The filename or extension is too long occurs

How to Reproduce?

Reproducer: https://github.com/ls-bit/quarkus-grpc-codegen-issue

Output of uname -a or ver

Microsoft Windows [Version 10.0.22631.3007]

Output of java -version

openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment GraalVM CE 17.0.8+7.1 (build 17.0.8+7-jvmci-23.0-b15)
OpenJDK 64-Bit Server VM GraalVM CE 17.0.8+7.1 (build 17.0.8+7-jvmci-23.0-b15, mixed mode, sharing)

Quarkus version or git rev

Quarkus 3.7.2

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

------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------

Build time:   2023-11-29 14:08:57 UTC
Revision:     28aca86a7180baa17117e0e5ba01d8ea9feca598

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.8 (GraalVM Community 17.0.8+7-jvmci-23.0-b15)
OS:           Windows 11 10.0 amd64

Additional information

No response

ls-bit avatar Feb 13 '24 13:02 ls-bit

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

quarkus-bot[bot] avatar Feb 13 '24 13:02 quarkus-bot[bot]

I'm not sure we can do anything. Can you try with WSL?

cescoffier avatar Feb 13 '24 15:02 cescoffier

Yes, it works with WSL. Maybe it is possible to pass some kind of parameter file to protoc as mentioned in https://github.com/protocolbuffers/protobuf/issues/274 ?

ls-bit avatar Feb 13 '24 16:02 ls-bit

Hum, it worse a try - I fear it's windows specific (meaning I cannot test).

cescoffier avatar Feb 13 '24 17:02 cescoffier

if it is of any help, i can offer to test on windows

ls-bit avatar Feb 14 '24 07:02 ls-bit

@ls-bit Sorry for the late reply - can you check https://github.com/quarkusio/quarkus/pull/39291?

cescoffier avatar Mar 08 '24 13:03 cescoffier

Awesome, I can confirm that the issue is fixed by your PR, thanks!

ls-bit avatar Mar 08 '24 17:03 ls-bit

Thanks for the feedback!

cescoffier avatar Mar 08 '24 19:03 cescoffier