Commit a3df02e
committed
fix(consensus): recover from Finalize-stall when a FinalizeBlock guard aborts apply
A FinalizeBlock guard (split-brain / hash-mismatch / add_block error) can break
out without applying block N, parking the engine at height N phase=Finalize while
the chain stays at N-1. need_new_round cannot reset it (bft.height N >
current_height N-1) and Finalize has no timeout, so the engine spins on
"phase timeout finalize" until a peer's block N arrives via gossip and advances
the chain — minutes when the mesh is degraded.
Detect the engine parked in Finalize one height ahead of the chain past a 5s
threshold and reset it via new_height() to re-run consensus for the unapplied
height. Safe: the bc.height() >= height skip-guard in the FinalizeBlock arms
no-ops a re-finalize if the block already landed (no double-apply), and a
re-proposal still needs 2/3 precommits, so safety is preserved.
Adds BftEngine::phase_elapsed() for the stall detection.1 parent 65cab1b commit a3df02e
2 files changed
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1948 | 1948 | | |
1949 | 1949 | | |
1950 | 1950 | | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
1951 | 1989 | | |
1952 | 1990 | | |
1953 | 1991 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1199 | 1208 | | |
1200 | 1209 | | |
1201 | 1210 | | |
| |||
0 commit comments