You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PBJ compiler fails when it encounters a reference to a message contained in another message. This makes it impossible to use intuitive message naming and well designed message scope.
Example
File distro_response.proto
syntax="proto3";
packagecom.zyxyl.distribution.partition;
messagePartitionResponse {
oneofresponse {
FullResponse.Acknowledgementacknowledgement=1;
FullResponse.EndOfStreamstatus=2;
}
}
messageFullResponse {
// several hundred lines elided here for claritymessageAcknowledgement {
oneofacknowledgements {
FullResponse.ChildAcknowledgementchild_ack=271;
FullResponse.ParentAcknowledgementparent_ack=272;
}
}
// several hundred lines elided here for claritymessageParentAcknowledgement {
uint32child_count=872;
}
// several hundred lines elided here for claritymessageChildAcknowledgement {
uint32partition_count=1438;
}
// several hundred lines elided here for clarityenumEndOfStream {
UNKNOWN=0;
CANCELED=1;
// several hundred lines elided here for clarity
}
}
The canonical protoc compiler compiles these and handles the references as expected (note, the file may contain several other messages with child messages named Acknowledgement, EndOfStream, etc...)
The PBJ compiler fails with an error similar to the following:
Not found pbj package for message or enum [FullResponse.Acknowledgement] in file [protobufs/distribution/partition/distro_response.proto]
Worse, if there are two EndOfStream subtypes and both are used only within their enclosing type, PBJ will silently promote one to global, and use the one type for all cases. This causes the PBJ code to incorrectly create or interpret the messages (due to using the wrong subtype) and only fails at runtime (fortunately our extensive automated testing does detect this).
This is a subtle data corruption bug, and it needs to be fixed.
The text was updated successfully, but these errors were encountered:
PBJ also promotes subtypes to global scope. This is incompatible with protoc, and is no longer something we can just ignore. PBJ cannot compile the block node block service (nor many common protocol buffer/gRPC APIs!) without a fix for this bug.
jsync-swirlds
changed the title
PBJ fails to handle sub-type references.
PBJ promotes sub-type references to global scope.
Oct 22, 2024
PBJ compiler fails when it encounters a reference to a message contained in another message. This makes it impossible to use intuitive message naming and well designed message scope.
Example
File distro_response.proto
The canonical protoc compiler compiles these and handles the references as expected (note, the file may contain several other messages with child messages named
Acknowledgement
,EndOfStream
, etc...)The PBJ compiler fails with an error similar to the following:
Worse, if there are two
EndOfStream
subtypes and both are used only within their enclosing type, PBJ will silently promote one to global, and use the one type for all cases. This causes the PBJ code to incorrectly create or interpret the messages (due to using the wrong subtype) and only fails at runtime (fortunately our extensive automated testing does detect this).This is a subtle data corruption bug, and it needs to be fixed.
The text was updated successfully, but these errors were encountered: