Fixed
Created: Jan 5, 2022
Updated: Feb 8, 2022
Resolved Date: Jan 12, 2022
Found In Version: 10.21.20.1
Fix Version: 10.21.20.9
Severity: Critical
Applicable for: Wind River Linux LTS 21
Component/s: Userspace
There is a dynamic initialization order problem between two compilation units(i.e. “.cc” files generated from “.proto” by “protoc”).
One is a .proto that defines “Extension” (GPB syntax via “extend” keyword), and the other is a .proto that imports and uses the “Extension” in the first .proto.
In this case, it seems that the strict initialization order is required between them - The C++ static object for “Extension” (i.e. class ExtensionIdentifier) generated from the first .proto and the C++ static object for “Descriptor” (i.e. class AddDescriptionRunner) generated from the second .proto.
Crash is occurring when the former object is initialized earlier than the latter object, otherwise it works well. These objects are defined in different compilation units with the same initialization priority, so the initialization order between them has undefined behavior.
Refer to the dynamic initialization: C++ - Initialization of Static Variables | Pablo Arias (pabloariasal.github.io)