Bug #77096
openRemoteReservationRejectedTooFull in state WaitLocalBackfillReserved causes src/osd/PeeringState.cc: 5264: ceph_abort_msg("we got a bad state machine event")
0%
Description
Description: rados/thrash-erasure-code-isa/{arch/x86_64 ceph clusters/{fixed-4} ec_optimizations/ec_optimizations_on mon_election/connectivity msgr-failures/osd-dispatch-delay objectstore/{bluestore/{alloc$/{stupid} base mem$/{normal-2} onode-segment$/{1M} write$/{v2/{compr$/{yes$/{zlib}} v2}}}} rados recovery-overrides/{more-active-recovery} supported-random-distro/{rocky_10} thrashers/careful_host thrashosds-health workloads/ec-rados-plugin=isa-k=8-m=6-technique=cauchy}
Related to https://tracker.ceph.com/issues/76751 in that both of these issues are caused by backfill reservation stimuli causing a crash in the peering state machine, but the stimuli and state involved are different.
Another race hazard in the Peering State Machine for backfill reservations
In this case there were 5 backfilling shards, 3 successfully completed the reserve, one revoked it which causes the attempt to backfill to stop. The code then starts another attempt at backfilling and starts making its local reservation, it is in this state when it receives the reply from the 5th shard about the previous attempt to backfill which was a rejection with toofull.
enter Started/Primary/Active/WaitRemoteBackfillReserved do_peering_event: epoch_sent: 1903 epoch_requested: 1903 RemoteBackfillReserved do_peering_event: epoch_sent: 1903 epoch_requested: 1903 RemoteBackfillReserved do_peering_event: epoch_sent: 1903 epoch_requested: 1903 RemoteBackfillReserved do_peering_event: epoch_sent: 1906 epoch_requested: 1906 RemoteReservationRevoked exit Started/Primary/Active/WaitRemoteBackfillReserved 9.984450 40 0.002663 enter Started/Primary/Active/NotBackfilling do_peering_event: epoch_sent: 1906 epoch_requested: 1906 RequestBackfill exit Started/Primary/Active/NotBackfilling 30.179865 82 0.004852 enter Started/Primary/Active/WaitLocalBackfillReserved do_peering_event: epoch_sent: 1923 epoch_requested: 1923 RemoteReservationRejectedTooFull exit Started/Primary/Active/WaitLocalBackfillReserved 15.113135 50 0.002579 exit Started/Primary/Active 194.206745 0 0.000000 exit Started/Primary 202.245563 0 0.000000 exit Started 202.245610 0 0.000000 enter Crashed
A weakness with the backfill reservations is that the Primary releasing reservations can race with the backfilling shards rejecting the reservation. There is no ack to the release, and consequently the reservation rejections can be received several state transitions later - especially in teuthology tests like this one that were injecting messenger/dispatch delays.
Note that the fact there were so many backfilling shards increases the likelihood of this problem being seen.
Fix is to simply ignore this stimuli in this state. Probably need to review all of the backfill reservations part of the state machine for other similar race hazards as there are 4 messages (GRANT, REJECT_TOOFULL, REVOKE_TOOFULL and REVOKE) that can all be sent from the Backfilling shard to the Primary and can race with the Primary sending a RELEASE.
YS Updated by yulong shi 7 days ago
I put up a fix: https://github.com/ceph/ceph/pull/74340
GRANT and REJECT_TOOFULL are now discarded in Active, like REVOKE_TOOFULL and REVOKE already are, so any Active state that isn't waiting for them ignores a stale one. While looking at this I noticed WaitLocalBackfillReserved used to discard GRANT (#44248), but its custom_reaction was dropped in 899f7e6d97e (pool migration), so main is also exposed to that older crash again.
The new TestPeeringState case reproduces the abort from this ticket without the fix.