protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

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

Open tforesti opened this issue 3 years ago • 6 comments

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!

tforesti avatar Dec 05 '22 00:12 tforesti

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.

github-actions[bot] avatar Dec 27 '23 10:12 github-actions[bot]

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!

tforesti avatar Dec 29 '23 09:12 tforesti

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.

haberman avatar Feb 12 '24 20:02 haberman

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.

github-actions[bot] avatar May 13 '24 10:05 github-actions[bot]

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

haberman avatar May 13 '24 13:05 haberman

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 🙂.

tforesti avatar May 13 '24 14:05 tforesti