Repository navigation
fix(fabric): stop channel config updates from racing orderer reads (backport #2608) - #2616
Merged
Merged
Conversation
Author
|
This pull request is merged. |
…2608) SetConfigOrderers replaced the orderer list with no lock while the broadcasters read it on their own goroutines: the CFT broadcaster through PickOrderer, the BFT broadcaster by ranging over Orderers. The Fabric-x channel config monitor calls it for every new channel config, and the Fabric committer for every config transaction. The update also appended to the configured orderers in place, so once the backing array had room, a config update overwrote the entries a BFT broadcast was still sending to. That broadcast had already sized its quorum from the old list and could reach the wrong orderers, or the same one twice. Fabric-x maps arma to BFT, so every Fabric-x node takes this path. The orderer list now has its own RWMutex, and SetConfigOrderers builds a new slice, so a slice Orderers returned is never written to. PickOrderer reads the list through Orderers. The lock is separate from mu so that pick can still take mu for the failure cooldowns. Fixes #2603 Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
mbrandenburger
force-pushed
the
mergify/bp/release-0.29/pr-2608
branch
from
November 12, 2026 07:35
4fe261e to
44b6302
Compare
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.Service.SetConfigOrderersreplaced the orderer list with no lock while the broadcasters read it on other goroutines, and its in-placeappendcould overwrite the entries an in-flight BFT broadcast was still sending to. The Fabric-x channel config monitor calls it for every new channel config, and Fabric-x mapsarmato BFT, so every Fabric-x node takes this path; the Fabric committer calls it for config transactions.Fixes #2603.
Changes
platform/fabric/core/generic/config/service.go:orderersgets its ownsync.RWMutex, held byOrderersandSetConfigOrderers. It is separate frommu, sopickcan still takemufor the failure cooldowns;SetConfigOrderersbuilds a new slice withslices.Concat, so a sliceOrderersreturned is never written to;PickOrdererreads the list throughOrderers;OrderersandSetConfigOrderersget godoc that states this.No API change. No documentation describes this code.
Testing
Two tests in
platform/fabric/core/generic/config/service_test.go:TestSetConfigOrderers_keepsReturnedSliceIntact: a slice taken fromOrdererskeeps its entries after a later updateexpected: "o1", actual: "o3")TestSetConfigOrderers_concurrentWithReaders: updates whilePickOrdererandOrderersread-racereports a data racego test -raceonplatform/fabric/core/generic/config,platform/fabric/core/generic/orderingandplatform/fabricx/core/channel/...: passmake checks: 0 issuesBackport
release-0.29: every Fabric-x node on v0.29.0 takes this path (armamaps to BFT), so a config update during a broadcast can send to the wrong orderers. The fix changes no API, schema step or wire format, and waiting for v0.30.0 leaves v0.29 nodes exposed until then.This is an automatic backport of pull request #2608 done by Mergify.