Inconsistency occurs in Java Proto builder when calling build() after clear()
After calling builder() after clear() of Pb builer , the consistency of isClean in message builder may break up. Here is the code snippet example.
We can see that finally the result printed is inconsistent between test3 and its subfield test1. And the reason is that build() operation does not mark those clear()ed child fields as isClean. This problem causes child field to be dirty, while parent is clean
// package CsVip;
// message test1{
// optional int32 tt = 1;
// }
//
// message test2{
// optional test1 t1 = 1;
// }
//
// message test3{
// optional test2 t2 = 1;
// }
public static void main(String[] args) {
//testpb dirty t2 dirty t1 clean testpb dirty t2 dirty t1 dirty
CsVip.test3.Builder testpb = CsVip.test3.newBuilder();
testpb.getT2Builder().getT1Builder(); //after: testpb dirty t2 dirty t1 clean
testpb.getT2Builder().clear(); //after: testpb dirty t2 dirty t1 dirty
testpb.getT2Builder().build();// t2 is still dirty ,but t1 is already clean , broke consistency
testpb.build();//after: testpb dirty t2 clean t1 dirty
testpb.getT2Builder().setT1(CsVip.test1.newBuilder().setTt(1).build());
LOGGER.error("testpb {}", testpb);//output: t2 {}
LOGGER.error("get T1 builder {}", testpb.getT2Builder().getT1Builder());
LOGGER.error("testpb {}", testpb);//output: t2 {t1 {tt: 1}}
}
@googleberg Is there any progress with this bug?
@choxsword I can see the behavior you describe, but I'm curious what negative impact you see from the inconsistency.
@choxsword nm, I think I see what you are saying now. It creates a stale cache problem.
@choxsword nm, I think I see what you are saying now. It creates a stale cache problem.
Will fixing this issue be taken into consideration in future version?
@googleberg hey bro! Is there any plan of this issue?
@googleberg looking forward to you reply!
Hi @choxsword, yes, I have a fix for this, it won't be in the next release, but the one after.
@googleberg thanks a lot. plz call me if that release is published.
@googleberg hey, I'm wondering about which time will that release be published?
@googleberg thanks for your timly support! I've seen the fix for this issus. By the way, how long will it take for me to see a official Protobuf Release with the newest update?
@choxsword The fix for this should be in the next release.
@googleberg when will next release be published? The newest version is the v21.9 relesase published one month ago.
The 21.10 release was delayed from the week of 2022/11/14 to next week (of 2022/11/28)
@googleberg Execuse me, is that release delayed again?
it is in progress.
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.
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.