protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.04k stars 15.42k forks source link

Error Unable to load descriptor: public_dep X is out of range #11146

Closed tforesti closed 2 days ago

tforesti commented 1 year ago

What version of protobuf and what language are you using? protobuf 3.21.6 PHP 8.1 protoc 3.12.4

What operating system (Linux, Windows, ...) and version? Linux Debian 11

What runtime / compiler are you using (e.g., python version or gcc version)

What did you do? We got an error with php protobuf extension on versions after 3.19.4 (it is ok on 3.19.4) and it seems to be a bug. It happens in a specific case : when we build a protobuf message (from a generated PHP class) and when the equivalent protobuf file imports another protobuf which also imports a protobuf file. I don't know if it is clear so I have reproduced it here: https://github.com/tforesti/php-protobuf-ext-issue Just build and run Dockerfile.

Error:

PHP Fatal error:  Unable to load descriptor: public_dep 0 is out of range
 in /app/build/GPBMetadata/Prototest.php on line 20

I found these error messages here: https://github.com/protocolbuffers/protobuf/blob/main/php/ext/google/protobuf/def.c#L950 https://github.com/protocolbuffers/protobuf/blob/main/php/ext/google/protobuf/php-upb.c#L9431

Are you aware of this? Did we do something wrong?

Thank you!

github-actions[bot] commented 8 months ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

tforesti commented 8 months ago

Hi, this issue is still relevant with version after 3.19.4.

I have updated my use cases here https://github.com/tforesti/php-protobuf-ext-issue with a OK Dockerfile (with 3.19.4) and KO Dockerfile (with latest version).

Thank you!

haberman commented 6 months ago

I suspect this is a bug in the code generator. There is some code that manually munges the dependency list: https://github.com/protocolbuffers/protobuf/blob/9473beb76c573e10eed3c98a246fe1411708ff14/src/google/protobuf/compiler/php/php_generator.cc#L839-L1049

I'm guessing that this code is removing a dependency from the list, but not updating the public_dependency list to match.

github-actions[bot] commented 3 months ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

haberman commented 3 months ago

I believe this is still an issue, though it will hopefully be resolved by adding proper extensions support to PHP.

tforesti commented 3 months ago

Yes, this is still an issue preventing us from updating our PHP Protobuf version. I test regularly with new versions. What do you mean by adding proper extensions support to PHP? I tried to investigate with what you mentioned, but I must admit that it was a little complicated for me at the moment 🙂.

github-actions[bot] commented 2 weeks ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

github-actions[bot] commented 2 days ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.