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

Support Protobuf Imports #254

Merged
merged 2 commits into from
Sep 8, 2021
Merged

Support Protobuf Imports #254

merged 2 commits into from
Sep 8, 2021

Conversation

CEikermann
Copy link
Contributor

@CEikermann CEikermann commented Sep 8, 2021

Fixes #237

Fixed by removing the "/" at the beginning of all file paths and added "/" as import path to the proto parser

Copy link
Contributor

@weeco weeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why the default (currentDirectory) was an issue and / (root directory) works apparently? I'm unsure if I understand the actual circumstances causing the issue.

backend/pkg/proto/service.go Outdated Show resolved Hide resolved
@CEikermann
Copy link
Contributor Author

Without the removal of the "/" at the beginning of the filePath, the parser is failing.

Error Log:

{"level":"warn","ts":"2021-09-08T16:05:25.599Z","msg":"failed to parse proto file to descriptor","file":"test_b.proto","line":5,"error":"test_b.proto:5:1: duplicate symbol test.b.protobuf.TestB: already defined as message in \"/test_b.proto\""}
{"level":"warn","ts":"2021-09-08T16:05:25.610Z","msg":"failed to parse proto file to descriptor","file":"test_b.proto","line":6,"error":"test_b.proto:6:3: duplicate symbol test.b.protobuf.TestB.test: already defined as field in \"/test_b.proto\""}
{"level":"fatal","ts":"2021-09-08T16:05:25.611Z","msg":"failed to start kafka service","error":"failed to create proto registry: failed to compile proto files to descriptors: failed to parse proto files to descriptors: parse failed: invalid proto source"}

My guess the files are parsed twice, once via input "/test_b.proto" and once via import "test_b.proto"
When we are removing the "/" at the beginning, seems the proto parser detects that the same file has been parsed already and skip it.

backend/pkg/proto/service.go Outdated Show resolved Hide resolved
Co-authored-by: Martin Schneppenheim <weeco91@gmail.com>
@weeco
Copy link
Contributor

weeco commented Sep 8, 2021

Thanks for taking a look and finding this!

@weeco weeco merged commit af76fbf into redpanda-data:master Sep 8, 2021
@CEikermann
Copy link
Contributor Author

Thanks for merging! :)

@CEikermann CEikermann deleted the patch-1 branch September 8, 2021 18:52
@weeco
Copy link
Contributor

weeco commented Sep 9, 2021

Just FYI @CEikermann this broke protobuf support if the Git provider (instead of file provider) is used. Can you post what your protobuf configuration looked like, so that I can figure out a solution that works for both?

@CEikermann
Copy link
Contributor Author

CEikermann commented Sep 10, 2021

Just FYI @CEikermann this broke protobuf support if the Git provider (instead of file provider) is used. Can you post what your protobuf configuration looked like, so that I can figure out a solution that works for both?

Sorry this was not intended.

#237 (comment) is this enough for you to reproduce? You can just use version 1.4 to reproduce this bug

@weeco
Copy link
Contributor

weeco commented Sep 11, 2021

@CEikermann I just tested this locally and I was not able to reproduce this. It might be because I'm running on windows at the moment, but I could probably also test on Mac. I tend to revert your changes made here because of that.

In my case an import like address.proto ends up in ddress.proto and that's of course not existent in my in memory filesystem. Hence just removing the first character can not be the solution after all :/

weeco added a commit that referenced this pull request Sep 11, 2021
@weeco
Copy link
Contributor

weeco commented Sep 11, 2021

I just pushed a version that removes the prefix / on all filepaths. Maybe that helps with the filepath mismatch. Could you try that? Otherwise I'd like to figure out how to reproduce your issue so that I can resolve them in a more methodical way.

@CEikermann
Copy link
Contributor Author

CEikermann commented Sep 13, 2021

@weeco I have tested with master 11afdfa

I do get an error when launching the kowl docker container

{"level":"fatal","ts":"2021-09-13T18:54:17.086Z","msg":"failed to start kafka service","error":"failed to create proto registry: failed to compile proto files to descriptors: failed to parse proto files to descriptors: test_b.proto: file does not exist"}

@CEikermann
Copy link
Contributor Author

As addition to #237 (comment)

docker-compose.yml

  kafka-ui:
    image: quay.io/cloudhut/kowl:master-11afdfa
    restart: unless-stopped
    volumes:
      - ./docker/kafka-ui/config.yml:/etc/kowl/config.yml
      - /tmp/protobuf/:/etc/protos/
    ports:
      - 9093:8080
    entrypoint: ./kowl --config.filepath=/etc/kowl/config.yml
    depends_on:
      - kafka
    networks:
      - main

Docker Desktop 4.0.0 @ MacOS 11.4

You can not reproduce this on your env with the given files?

@CEikermann
Copy link
Contributor Author

@weeco are you able to reproduce the issue on your env?

@weeco
Copy link
Contributor

weeco commented Sep 20, 2021

@CEikermann Yes, I can reproduce it using Docker, not within my IDE unfortunately. So I'm not entirely sure what's going on there, but I will try to figure it out as soon as I have some time for it

@CEikermann
Copy link
Contributor Author

Have created an follow up issue of this: #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with import protobuf files from nested directories
2 participants