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

The actual proto file compilation error is to shown in protoc tool #7238

Closed
daneshk opened this issue Oct 7, 2024 · 2 comments · Fixed by ballerina-platform/protoc-tools#54
Assignees
Labels
Good first issue Good for newcomers module/grpc Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug

Comments

@daneshk
Copy link
Member

daneshk commented Oct 7, 2024

Description:
When there is an issue when compiling the proto file using the Ballerina protoc tool, The actual error is not printed instead, it shows as,

Oct 05, 2024 7:25:17 PM io.ballerina.protoc.protobuf.cmd.GrpcCmd generateBalFile
SEVERE: An error occurred when generating the proto descriptor.
io.ballerina.protoc.protobuf.exception.CodeGeneratorException: Invalid command syntax. Stream closed
	at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.handleProcessExecutionErrors(BalFileGenerationUtils.java:110)
	at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.generateDescriptor(BalFileGenerationUtils.java:83)
	at io.ballerina.protoc.protobuf.cmd.DescriptorsGenerator.generateRootDescriptor(DescriptorsGenerator.java:148)
	at io.ballerina.protoc.protobuf.cmd.GrpcCmd.generateBalFile(GrpcCmd.java:251)
	at io.ballerina.protoc.protobuf.cmd.GrpcCmd.execute(GrpcCmd.java:165)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at io.ballerina.cli.launcher.Main.main(Main.java:59)
Caused by: java.io.IOException: Stream closed
	at java.base/java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:206)
	at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:411)
	at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:405)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:350)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:393)
	at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:217)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:171)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:188)
	at java.base/java.io.BufferedReader.fill(BufferedReader.java:160)
	at java.base/java.io.BufferedReader.implReadLine(BufferedReader.java:370)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:347)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:436)
	at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.handleProcessExecutionErrors(BalFileGenerationUtils.java:105)
	... 6 more

From this stack trace, we can't get the actual error. This issue is to show the correct error.

@daneshk
Copy link
Member Author

daneshk commented Oct 7, 2024

Steps to reproduce,

Create a proto file with syntax errors and use the Ballerina protoc tool[1] to generate the Ballerina source code.

  1. https://ballerina.io/learn/grpc-tool/

Copy link

github-actions bot commented Oct 8, 2024

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers module/grpc Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant