Open gazar opened 9 months ago
@esrauchg please take a look
@gazar Do you mind narrowing down the bug report here? Is 'fields' zero length? Is there an entry for 'tag' but it doesn't have a string value or has an empty string?
I ran your repro code internally the listed behavior doesn't reproduce: it does find the tag and does not hit the "No tag via find" conditional. You may also find something interesting here if you remove the 'ignore_unknown_fields' and see if that gives you a parse failure from e.g. stale gencode or something (though its hard to see why that would be in this case)
Perhaps you can update your case, print the content.DebugString() to see what it says?
@esrauchg thank you for looking into this.
I've updated the example to shorten it and added more prints. I've managed to reproduce the issue again, on v26.0-rc2. However, this time the issue reproduces inconsistently. The following two prints sometimes change order, but the issue may reproduce regardless of their order:
Key name: 'size'
Key name: 'tag'
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.
Still waiting for someone to have a closer look at the issue.
I tried your repro snippet and don't see the issue reproduce in internal main tip.
Can you clarify further the environment that you get the issue? If you're only able to reproduce this under one specific Ubuntu configuration then I'm suspicious that this is most likely an issue of the system having some vendored protobuf package installed that is being linked compared to your intended protobuf version (where the latter is the used for the .pb.h generation); C++ Protobuf requires exact version match between the protoc and the linked proto runtime (even 'minor' version releases are not guaranteed to be skew safe compatible between generated code and runtime).
@esrauchg thank you for taking the time to look into this further.
# ldd -d bin/test
linux-vdso.so.1 (0x00007fff9d1b9000)
libprotobuf.so.27.0.3 => /home/gazar/.conan/data/protobuf/27.0-rc3+2/pan/dev/package/4dd49b453a8d01f6f5acb40cd2c983d832a6da45/lib/libprotobuf.so.27.0.3 (0x00007fe22d2d4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe22d2a7000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe22d0c5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe22cf76000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe22cf5b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe22cd67000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe22d70b000)
/home/gazar/.conan/data/protobuf/27.0-rc3+2/pan/dev/package/4dd49b453a8d01f6f5acb40cd2c983d832a6da45/bin/protoc --cpp_out=. test.proto
_GLIBCXX_USE_CXX11_ABI=0
flag.Can you provide the specific gcc version number that you're seeing the issue on? Thanks!
$ g++-9 --version
g++-9 (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
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.
What version of protobuf and what language are you using? Version: v26.0-rc2 Language: C++
What operating system (Linux, Windows, ...) and version? Linux Ubuntu 20
What runtime / compiler are you using (e.g., python version or gcc version) GCC 9
What did you do? With a protobuf message defined like the following:
And a JSON string that looks like the following:
comp2
component (doesn't matter if viafind()
or iteration).find()
on the google.protobuf.Struct'sfields()
map to get thetag
field's value.What did you expect to see An iterator to the
tag
field.What did you see instead?
std::end()
. UPDATE 2024-02-21 (v26.0-rc2): Inconsistently!Note that if step 3 is done via iteration of the fields in a
for
loop, thentag
is iterated correctly.Additional Information
Code Example Attached is a short C++ sample test code that illustrates the problem:
Program output: