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

TypeError: Couldn't build proto file into descriptor pool! #40

Closed
tuanngokien opened this issue Aug 22, 2022 · 4 comments · Fixed by #41 or #42
Closed

TypeError: Couldn't build proto file into descriptor pool! #40

tuanngokien opened this issue Aug 22, 2022 · 4 comments · Fixed by #41 or #42
Labels
bug Something isn't working

Comments

@tuanngokien
Copy link
Contributor

I am using cyber_record to read the Cyber record file.
At the moment, I could use it to read messages from channels when the record file is produced by Apollo in the SimControl mode.
However, instead of using SimControl, when using LGSVL to simulate the scenario (connect it through bridge to Apollo), the Cyber record file cannot be read by cyber_record (although the file could still be playable by official cyber_recorder tool).

The error happened when reading the file is as follows:

Traceback (most recent call last):
  File "/sample_dir/test_analyzer.py", line 9, in <module>
    record = Record(record_path)
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/record.py", line 102, in __init__
    self._open(f, mode, allow_unindexed)
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/record.py", line 251, in _open
    if mode == 'r': self._open_read(f)
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/record.py", line 272, in _open_read
    self._reader.start_reading()
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/reader.py", line 74, in start_reading
    self._create_message_type_pool()
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/reader.py", line 240, in _create_message_type_pool
    self._add_dependency(proto_desc)
  File "/sample_dir/venv/lib/python3.7/site-packages/cyber_record/reader.py", line 233, in _add_dependency
    self.desc_pool.Add(file_desc_proto)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "modules/perception/proto/traffic_light_detection.proto":
  modules/perception/proto/traffic_light_detection.proto: A file with this name is already in the pool.

Given record file for reproducing this bug: https://drive.google.com/file/d/1qr_4Jhz0KWrXsdgcGVdrvsfQ65GB0nCq/view?usp=sharing

@daohu527
Copy link
Owner

According to this issue protocolbuffers/protobuf#3002

proto file that collides with name of proto file from another package. Importing both python packages is not possible as I get this error.

You can try to solve by

pip uninstall protobuf
pip install --no-binary protobuf protobuf

@tuanngokien
Copy link
Contributor Author

tuanngokien commented Aug 22, 2022

According to this issue protocolbuffers/protobuf#3002

proto file that collides with name of proto file from another package. Importing both python packages is not possible as I get this error.

You can try to solve by

pip uninstall protobuf
pip install --no-binary protobuf protobuf

I have tried this but it does not work.
Also, I think protobuf package is not the cause because I could still parse record file of Apollo in SimControl mode.
With LGSVL connected to Apollo, I see that some new channels have been bridged, that might be the reason why there could be some conflicts between dependencies of these channels while cyber_record processing a file.

Update: I figured out the solution #41 by checking whether the file descriptor was added before for avoiding duplication.

@daohu527
Copy link
Owner

I don't think it's a good idea, we need to find the cause and then fix it.

@daohu527
Copy link
Owner

@tuanngokien I was wrong before, after re-confirmed that there will indeed be duplicate messages when recursive. For example, there're two message A and B, and we recursive A, we already add A and B, then the next B message will add twice.

A->B
B

So your workaround looks correct

@daohu527 daohu527 linked a pull request Aug 23, 2022 that will close this issue
@daohu527 daohu527 added the bug Something isn't working label Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants