Fail to sync nodes in raft consensus
System information
Geth version: 1.5.0-unstable
OS & Version: Ubuntu 16.04
Branch, Commit Hash or Release: Git Commit: ddb011f3a065461ca0ca49ffab596de9154198dc
Expected behaviour
Having set up 8 nodes and using raft consensus, all of the 8 nodes should always be in sync. When some nodes are killed/reset (to simulate the occurrence of fault) and recovered (i.e. run geth again), these nodes should be able to sync with other nodes and eventually share the same block number.
Actual behaviour
If the killed node is restarted quickly (i.e. block numbers don't differ too much, say 50 blocks), the killed node can still sync with the network. Otherwise, the block number of killed/reset nodes remains at the point of being killed/zero while those of surviving nodes keep sync.
Steps to reproduce the behaviour
- Create 8 nodes using
quorum-maker(node1: maker/voter; node2-7: voter; node8: none) - Run nodes in docker (i.e.
docker-compose up). Use script provided byquorum-makerto switch to Raft Consensus. And then restart. - Keep sending transactions to node1-7 to keep them busy working. (Skip node8 because node8 has no account).
- [Randomly kill a node (
docker stop). Wait for a few minutes and start the killed node again. (docker restartordocker start) ] OR [use the script provided byquorum-makerto reset the node and start the reset node.] - Observe the block number. The block number of killed/reset node froze at the point it's killed/zero while others keep in sync and growing.
So what should I do in order to sync the network in this case other than resetting the whole network?
Backtrace
Part of the log file of the not-synced, killed node1 (--verbosity 4) :
I0919 09:03:21.939363 internal/ethapi/api.go:1198] Tx(0x6c47a150b9e9f4de90239d2047b12ec97f71e0f4d51840acc374a05df81a62b7) to: 0xe92d28f5e0b68af589da37b9aee4a1f2335d7ede
I0919 09:03:21.939373 logger/log_raft_checkpoint.go:18] RAFT-CHECKPOINT TX-CREATED [0x6c47a150b9e9f4de90239d2047b12ec97f71e0f4d51840acc374a05df81a62b7 0xe92d28f5e0b68af589da37b9aee4a1f2335d7ede]
I0919 09:03:21.969876 raft/handler.go:616] Non-extending block: 325dc1082170317c9c4926ed9377641d359e9880ef643aa131f2e8b6bb8c2474 (parent is f20b3deeecf96fff36a1de3c6372dfb9b7af06d302c520c8c09056681ec5ce1f; current head is be0bf3666717f5f764843b56808857be70491d06e8d4b99a67938b6b5d254fc0)
I0919 09:03:21.969900 raft/persistence.go:55] Persistent applied index write: 16545
I0919 09:03:21.969951 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 325dc1082170317c9c4926ed9377641d359e9880ef643aa131f2e8b6bb8c2474; current head is be0bf3666717f5f764843b56808857be70491d06e8d4b99a67938b6b5d254fc0
I0919 09:03:21.970010 raft/minter.go:125] Someone else mined invalid block 325dc1082170317c9c4926ed9377641d359e9880ef643aa131f2e8b6bb8c2474; ignoring
I0919 09:03:22.013501 raft/handler.go:616] Non-extending block: 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90 (parent is 325dc1082170317c9c4926ed9377641d359e9880ef643aa131f2e8b6bb8c2474; current head is be0bf3666717f5f764843b56808857be70491d06e8d4b99a67938b6b5d254fc0)
I0919 09:03:22.013532 raft/persistence.go:55] Persistent applied index write: 16546
I0919 09:03:22.013603 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90; current head is be0bf3666717f5f764843b56808857be70491d06e8d4b99a67938b6b5d254fc0
I0919 09:03:22.013692 raft/minter.go:125] Someone else mined invalid block 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90; ignoring
I0919 09:03:22.941022 core/tx_pool.go:507] Promoting queued transaction:
TX(7ca33591c5fe408890425d0bc7a417bc55aebc304db5ebf09e94274ee2389bd1)
Contract: false
From: a36af625772fb79aa338a42a2f14c6fd4450d2b3
To: d4775909e04daad8d5fe750a568c8685c29d0ece
Nonce: 8568
GasPrice: 0
GasLimit 90000
Value: 10000000000000000000
Data: 0x
V: 0x1b
R: 0xc523e2ba8b9ac338790eb9ff5933fa9c004c6001d31451fa10239a71083e8142
S: 0x4ba3ba88c5803a4c7f78c3ce250b04cb5afc241a5dbab0881e1dad537467aea8
Hex: f86a8221788083015f9094d4775909e04daad8d5fe750a568c8685c29d0ece888ac7230489e80000801ba0c523e2ba8b9ac338790eb9ff5933fa9c004c6001d31451fa10239a71083e8142a04ba3ba88c5803a4c7f78c3ce250b04cb5afc241a5dbab0881e1dad537467aea8
Part of log file of not-synced, killed node3 (--verbosity 2):
I0919 09:03:22.015023 raft/handler.go:616] Non-extending block: 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90 (parent is 325dc1082170317c9c4926ed9377641d359e9880ef643aa131f2e8b6bb8c2474; current head is 4989084ba7e202da02341b1757fd17a172a2ad773dfd335bce63edb94e4ca7c3)
I0919 09:03:22.015093 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90; current head is 4989084ba7e202da02341b1757fd17a172a2ad773dfd335bce63edb94e4ca7c3
I0919 09:03:22.015175 raft/minter.go:125] Someone else mined invalid block 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90; ignoring
I0919 09:03:22.971783 raft/handler.go:616] Non-extending block: e8b6157f7116ebc5b8ad542153003c41792769fa745b731827452f9c843b5bed (parent is 3aa6800b6693bb9dfec549ab67c2e2b8c2a4f1a9b22f4f3b7656715279442e90; current head is 4989084ba7e202da02341b1757fd17a172a2ad773dfd335bce63edb94e4ca7c3)
I0919 09:03:22.971876 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block e8b6157f7116ebc5b8ad542153003c41792769fa745b731827452f9c843b5bed; current head is 4989084ba7e202da02341b1757fd17a172a2ad773dfd335bce63edb94e4ca7c3
I0919 09:03:22.971956 raft/minter.go:125] Someone else mined invalid block e8b6157f7116ebc5b8ad542153003c41792769fa745b731827452f9c843b5bed; ignoring
Part of log file of not-synced, reset node (--verbosity 4)
I0919 16:08:09.263396 core/tx_pool.go:514] Removed cap-exceeding queued transaction:
TX(9e7897e25e195f3aa31d9d4bb7cb33e58b25433875a52f6d6e5f592a021dccb2)
Contract: false
From: c80e25e5d52982ae9a7bba1ad9c8074482418eaa
To: 6f4fb992a5300fdfc832fc0eef08e73e1f365812
Nonce: 54651
GasPrice: 0
GasLimit 90000
Value: 10000000000000000000
Data: 0x
V: 0x1b
R: 0x6215ba46151f26661e61a0bdbe69f6462cde48a2db67b88a90270bd96bdc0d24
S: 0xc4295694d5d7cd65ae1706c9c2eae7b70e4236ef39330c297e77c80c40c21b7
Hex: f86a82d57b8083015f90946f4fb992a5300fdfc832fc0eef08e73e1f365812888ac7230489e80000801ba06215ba46151f26661e61a0bdbe69f6462cde48a2db67b88a90270bd96bdc0d24a00c4295694d5d7cd65ae1706c9c2eae7b70e4236ef39330c297e77c80c40c21b7
I0919 16:08:09.268145 raft/handler.go:616] Non-extending block: 432de23d565b4449fd47534f824cbe59b3164ac3ff10976378cd02babfecadb3 (parent is 2e2594fa56e019f0f70df95bee0748f73361d52f7107d655300c46fdcbdf2718; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f)
I0919 16:08:09.268165 raft/persistence.go:55] Persistent applied index write: 89127
I0919 16:08:09.268217 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 432de23d565b4449fd47534f824cbe59b3164ac3ff10976378cd02babfecadb3; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f
I0919 16:08:09.268266 raft/minter.go:125] Someone else mined invalid block 432de23d565b4449fd47534f824cbe59b3164ac3ff10976378cd02babfecadb3; ignoring
I0919 16:08:09.269324 raft/handler.go:616] Non-extending block: 5bdcf55b48a505680875864887a1106c0ee6563bb07a50968ed1b64925b615d0 (parent is 432de23d565b4449fd47534f824cbe59b3164ac3ff10976378cd02babfecadb3; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f)
I0919 16:08:09.269337 raft/persistence.go:55] Persistent applied index write: 89128
I0919 16:08:09.269389 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 5bdcf55b48a505680875864887a1106c0ee6563bb07a50968ed1b64925b615d0; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f
I0919 16:08:09.269416 raft/minter.go:125] Someone else mined invalid block 5bdcf55b48a505680875864887a1106c0ee6563bb07a50968ed1b64925b615d0; ignoring
I0919 16:08:09.271619 raft/handler.go:616] Non-extending block: 99508eb713b1824ff2fef839cf346a420cb6400de4f871260290b1a7f1d07c71 (parent is 5bdcf55b48a505680875864887a1106c0ee6563bb07a50968ed1b64925b615d0; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f)
I0919 16:08:09.271633 raft/persistence.go:55] Persistent applied index write: 89129
I0919 16:08:09.271679 raft/minter.go:118] Handling InvalidRaftOrdering for invalid block 99508eb713b1824ff2fef839cf346a420cb6400de4f871260290b1a7f1d07c71; current head is 379303b947fa248b0b9af28cb0a45506593460c587e6fdeef0594c84a1ad378f
I0919 16:08:09.271706 raft/minter.go:125] Someone else mined invalid block 99508eb713b1824ff2fef839cf346a420cb6400de4f871260290b1a7f1d07c71; ignoring
Killed/reset node can sync with the network in master branch (70fff48b2ea7318bcf204610e479ac8a97ed7b74). Closing
@fixanoid , I'm facing the same error, do you know the solution of this?
@Ajaysethi136 please open a new issue so we could ask you for additional details. If its easier, please feel free to join our slack for faster support.
As far as issue: depending how the older node rejoins the network, a new raft id may need to be issued to bring a new node up to date.