[protobuf] internal/impl: fix size cache semantics with lazy decoding

Skip to first unread message

Michael Stapelberg (Gerrit)

May 17, 2024, 10:13:41 AMMay 17
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Lasse Folger, Go LUCI, golang-co...@googlegroups.com

Michael Stapelberg submitted the change

Change information

Commit message:
internal/impl: fix size cache semantics with lazy decoding

When a message (within an extension) is lazily decoded, its size cache is
initialized to 0 (the zero value for an int32). This doesn’t mean the size cache
reads 0, but rather that it was not initialized.

This fixes TestExtensionGetRace being flaky since CL 580015.

related to golang/protobuf#1609
Change-Id: Ia305badadd300679975f230005c3e33c94050e4a
Reviewed-by: Lasse Folger <lasse...@google.com>
  • M internal/impl/encode.go
Change size: S
Delta: 1 file changed, 12 insertions(+), 6 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Lasse Folger
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: protobuf
Gerrit-Branch: master
Gerrit-Change-Id: Ia305badadd300679975f230005c3e33c94050e4a
Gerrit-Change-Number: 586396
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Stapelberg <stape...@google.com>
Gerrit-Reviewer: Lasse Folger <lasse...@google.com>
Gerrit-Reviewer: Michael Stapelberg <stape...@google.com>
Reply all
Reply to author
0 new messages