Repository navigation
Commit 62486fd
fix(buzz-acp): reap respawn JoinSet, gate re-sleep on real in-flight
The idle-pool-sleep teardown gate used `!respawn_tasks.is_empty()` as a
respawn busy bit, but completed respawn tasks are never joined: their
payloads arrive out-of-band via `respawn_rx` and the only JoinSet op is
`.shutdown()` at teardown. Tokio retains finished tasks in a JoinSet
until `join_next`, so after the first slot refill or crash recovery
`!respawn_tasks.is_empty()` stays true forever — `idle_pool_sleep_due`
could then never pass and a woken lazy pool would never re-sleep,
defeating the feature.
Fix uses the authoritative signal that already exists:
`any_respawn_in_flight(&crash_history)`, backed by each slot's
`respawn_in_flight` flag (set at all three spawn sites, cleared when the
`respawn_rx` payload is received, and guaranteed to clear even on panic
via RespawnGuard). The gate call site now reads that instead of JoinSet
occupancy, keeping `!wake_tasks.is_empty()` (which self-drains).
Also add a non-blocking JoinSet reaper
(`respawn_tasks.join_next().now_or_never()`) after the `respawn_rx`
drain, so completed handles are released and the set does not grow
without bound — same pattern already used for `pool.join_set`.
Regression: `respawn_in_flight_signal_gates_then_clears_for_sleep`
proves the busy->eligible transition through the real predicate, and
`completed_respawn_tasks_are_reaped_from_the_joinset` proves the reaper
drains finished tasks.
Co-authored-by: Mongo <5c25403eab7271f9f94ddd4f2b270e8cac2c92e2c830c51877cca6ec974ffb3f@buzz.block.builderlab.xyz>
Signed-off-by: Wes <[email protected]>1 parent edac9dc commit 62486fd
1 file changed
Lines changed: 86 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1637 | 1637 | | |
1638 | 1638 | | |
1639 | 1639 | | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
1640 | 1713 | | |
1641 | 1714 | | |
1642 | 1715 | | |
| |||
2255 | 2328 | | |
2256 | 2329 | | |
2257 | 2330 | | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
2258 | 2342 | | |
2259 | 2343 | | |
2260 | 2344 | | |
| |||
2769 | 2853 | | |
2770 | 2854 | | |
2771 | 2855 | | |
2772 | | - | |
| 2856 | + | |
| 2857 | + | |
2773 | 2858 | | |
2774 | 2859 | | |
2775 | 2860 | | |
| |||
0 commit comments