Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-14327 Race in BlockWriter corrupts config sequence
There is a race between the go-routine that submits a config-update block to the internal thread that writes the (previous) block asynchronously to the ledger. The race may cause to back-to-back config-update transactions to have bad block metadata - in the first the LAST_CONFIG will be ok, but in the second the LAST_CONFIG will point to the first, rather then the second. This may happen independently in different ledgers, creating a fork. This fix avoid Bundle update before the go-routine in WriteBlock() finished writing the previous block. We do this (in particular) to prevent bw.support.Sequence() from advancing before the go-routine in WriteBlock() reads it. In general, this prevents the StableBundle from changing before the go-routine in WriteBlock() finishes. The unit test replicates the condtions that cause the bug and verifies it is fixed (without the fix it fails). See respective JIRA for more details. Change-Id: If26654e006b4fe6d48d2d8fc73894eaff2426dcd Signed-off-by: Yoav Tock <tock@il.ibm.com>
- Loading branch information