Description
Description
After deleting a channel from all Orderers and Peers, creating a channel with the same name again causes Orderer process to terminate abnormally.
Steps to reproduce
Environment: Fabric v2.5.9, 3 Raft Orderers, 1 PeerOrg with 2 Peers (no System Channel)
- Create an application channel.
- Use "osnadmin channel remove" and "peer node unjoin" commands to remove the Channel from the Orderer and Peer.
- After the information about that Channel has disappeared from the network, create a channel with the same name again.
In step 3, I created a new genesis block using the "configtxgen" command and tried to create a channel.
However, the following hash value inconsistency error occurred at Orderer, and the process went down.
panic: [channel: <Channel name>] Could not append block: unexpected Previous block hash. Expected PreviousHash = [<Hash value A>], PreviousHash referred in the latest block= [<Hash value B>]
"Hyerledger Fabric Docs" does not state whether it is okay to create a channel with the same name as a previously created channel, but I think that the Orderer process should be prevented from abnormal termination.
Related issue
Issue #4016 reports that WAL & snapshots data remains on Raft Orderer after a channel is deleted. This bug has not been fixed at this time.
When I deleted old WAL & snapshots directories on Raft Orderer in above step 2 and created the channel again, the channel was created successfully. Therefore, I assume that Orderer process down is related to the problem reported in this issue. I would appreciate if anyone could investigate whether this assumption is correct.
Full text of Orderer's crush log
2025-03-26 14:43:42.536 JST [orderer.consensus.etcdraft] writeBlock -> INFO 107 Writing block [1] (Raft index: 5) to ledger channel=forstaging2029 node=2
2025-03-26 14:43:42.543 JST [orderer.commmon.multichannel] commitBlock -> PANI 108 [channel: forstaging2029] Could not append block: unexpected Previous block hash. Expected PreviousHash = [a65f4ca5f9be4c1aefa72768399af0eba9177507ca3f77d6a71822d35f70ce25], PreviousHash referred in the latest block= [e47209331224f357b8c98446fa4a36f9d56d7b5456cb52f52d69d6e255cca2d9]
panic: [channel: forstaging2029] Could not append block: unexpected Previous block hash. Expected PreviousHash = [a65f4ca5f9be4c1aefa72768399af0eba9177507ca3f77d6a71822d35f70ce25], PreviousHash referred in the latest block= [e47209331224f357b8c98446fa4a36f9d56d7b5456cb52f52d69d6e255cca2d9]
goroutine 179 [running]:
go.uber.org/zap/zapcore.CheckWriteAction.OnWrite(0x0?, 0x0?, {0x0?, 0x0?, 0xc007bc7d00?})
#011/vendor/go.uber.org/zap/zapcore/entry.go:196 +0x54
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc007aa2dd0, {0x0, 0x0, 0x0})
#011/vendor/go.uber.org/zap/zapcore/entry.go:262 +0x24e
go.uber.org/zap.(*SugaredLogger).log(0xc000115ce8, 0x4, {0x11f0e60?, 0x0?}, {0xc007cf9598?, 0x1?, 0xdae96f?}, {0x0, 0x0, 0x0})
#011/vendor/go.uber.org/zap/sugar.go:355 +0xec
go.uber.org/zap.(*SugaredLogger).Panicf(...)
#011/vendor/go.uber.org/zap/sugar.go:229
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panicf(...)
#011/common/flogging/zap.go:74
github.com/hyperledger/fabric/orderer/common/multichannel.(*BlockWriter).commitBlock(0xc007884000, {0xc007c99736, 0x9, 0x9})
#011/orderer/common/multichannel/blockwriter.go:204 +0x14f
github.com/hyperledger/fabric/orderer/common/multichannel.(*BlockWriter).WriteBlockSync(0xc007d21500?, 0xc007c99740?, {0xc007c99736?, 0x13a3b78?, 0xc007cd9020?})
#011/orderer/common/multichannel/blockwriter.go:193 +0xe5
github.com/hyperledger/fabric/orderer/common/multichannel.(*BlockWriter).WriteConfigBlock(0xc007884000, 0xc007bccd40, {0xc007c99736, 0x9, 0x9})
#011/orderer/common/multichannel/blockwriter.go:159 +0x81d
github.com/hyperledger/fabric/orderer/consensus/etcdraft.(*Chain).writeConfigBlock(0xc0078f0008, 0xc007bccd40, 0x5)
#011/orderer/consensus/etcdraft/chain.go:1317 +0x2fa
github.com/hyperledger/fabric/orderer/consensus/etcdraft.(*Chain).writeBlock(0xc0078f0008, 0xc007bccd40, 0x5)
#011/orderer/consensus/etcdraft/chain.go:897 +0x2e9
github.com/hyperledger/fabric/orderer/consensus/etcdraft.(*Chain).apply(0xc0078f0008, {0xc0078dc038, 0xa, 0x0?})
#011/orderer/consensus/etcdraft/chain.go:1142 +0x2b3
github.com/hyperledger/fabric/orderer/consensus/etcdraft.(*Chain).run(0xc0078f0008)
#011/orderer/consensus/etcdraft/chain.go:805 +0xc13
created by github.com/hyperledger/fabric/orderer/consensus/etcdraft.(*Chain).Start in goroutine 1
#011/orderer/consensus/etcdraft/chain.go:376 +0x289