Commit 48e5bfd
Fix arm-after-restart race in test_auto_fork_recovery_transaction_fork (#27322)
## Description
`test_auto_fork_recovery_transaction_fork` (added in #27062) fails when
the restarted target validator completes catch-up re-execution before
the fork-injection failpoint is armed — the injection only fires on the
checkpoint-executor path, so once catch-up finishes the fork window is
closed forever and `assert!(forked, ...)` times out after 60s. The
test's own comment documents the bet ("start() returns before the
executor catches up, so the injection lands first"), but the ordering is
not guaranteed: catch-up can run inside `start()`'s internal awaits, and
how much real-thread progress happens there is environment-dependent.
There is also a latent hazard: a fork tripping before
`register_fork_kill_failpoints` is armed would `fatal!`-abort the whole
sim.
Observed on the v1.77.0 version-bump PR (#27321): the `simtest` job
failed twice with the identical signature
([run](https://github.com/MystenLabs/sui/actions/runs/29551659120)) —
same merge commit, same sha-derived `MSIM_TEST_SEED`
(`11397606143398739615`). Full analysis on
[#27062](#27062 (comment)).
**The fix**: arm the fork injection and the kill hooks **before**
restarting the target. The target's new sim node id is unknowable until
`start()` returns, so the closures match by exclusion instead: while the
target is down, snapshot the sim ids of every running node (remaining
validators + fullnodes) — any id outside that set executing transactions
can only be the restarted target (nothing else starts during the test).
`register_fork_kill_failpoints` now takes a resolver closure instead of
a fixed map; the two sibling call sites pass a closure over their
existing maps, behavior unchanged.
## Test plan
All local, on this branch (`cargo simtest -p sui-benchmark`):
- `test_auto_fork_recovery_transaction_fork`: PASS on seeds 1, 2, 3 and
on CI's failing seed `11397606143398739615`
- Siblings using the refactored helper:
`test_auto_fork_recovery_checkpoint_fork` PASS,
`test_split_brain_recovery_via_checkpoint_overrides` PASS
Honest caveat: I could not reproduce the CI failure locally — the
unfixed test passed 10/10 on this 16-core box across seeds (including
CI's exact merge tree + seed) and under CPU saturation. The failure
needs whatever real-thread scheduling conditions CI runners produce; the
fix removes the ordering dependence entirely rather than tuning timings,
so it holds regardless of which environments can currently lose the
race.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 2684bb6 commit 48e5bfd
1 file changed
Lines changed: 57 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1044 | 1044 | | |
1045 | 1045 | | |
1046 | 1046 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | 1055 | | |
1055 | | - | |
| 1056 | + | |
1056 | 1057 | | |
1057 | | - | |
1058 | | - | |
| 1058 | + | |
| 1059 | + | |
1059 | 1060 | | |
1060 | 1061 | | |
1061 | 1062 | | |
| |||
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | | - | |
| 1068 | + | |
1068 | 1069 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1070 | + | |
| 1071 | + | |
1072 | 1072 | | |
1073 | 1073 | | |
1074 | 1074 | | |
| |||
1515 | 1515 | | |
1516 | 1516 | | |
1517 | 1517 | | |
1518 | | - | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1519 | 1522 | | |
1520 | 1523 | | |
1521 | 1524 | | |
| |||
1659 | 1662 | | |
1660 | 1663 | | |
1661 | 1664 | | |
1662 | | - | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1663 | 1669 | | |
1664 | 1670 | | |
1665 | 1671 | | |
| |||
1770 | 1776 | | |
1771 | 1777 | | |
1772 | 1778 | | |
1773 | | - | |
1774 | | - | |
1775 | | - | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
1776 | 1788 | | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
1780 | | - | |
1781 | | - | |
1782 | | - | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
1783 | 1795 | | |
1784 | 1796 | | |
1785 | 1797 | | |
1786 | 1798 | | |
1787 | 1799 | | |
1788 | 1800 | | |
1789 | | - | |
| 1801 | + | |
1790 | 1802 | | |
1791 | | - | |
1792 | | - | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1793 | 1806 | | |
1794 | 1807 | | |
1795 | 1808 | | |
1796 | 1809 | | |
1797 | 1810 | | |
1798 | 1811 | | |
1799 | 1812 | | |
1800 | | - | |
1801 | | - | |
1802 | 1813 | | |
1803 | 1814 | | |
1804 | 1815 | | |
1805 | | - | |
1806 | | - | |
1807 | | - | |
1808 | | - | |
1809 | | - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
1810 | 1835 | | |
1811 | 1836 | | |
1812 | 1837 | | |
| |||
0 commit comments