Commit 663fd06
Merge #155669
155669: sql: add safety gates for pausable portal cleanup and flow invalidation r=ZhouXing19 a=ZhouXing19
Informs: https://github.com/cockroachlabs/support/issues/3463
When a pausable portal encounters an error during execution, two issues can lead to panics on subsequent resume attempts:
1. The underlying FlowBase gets reset to nil during cleanup, but the portal's flow reference remains non-nil, causing hasFlowForPausablePortal() to incorrectly return true.
2. Errored portals are not removed from the portal map because deletion only occurs when execStmt() returns a non-nil fsm.Event.
This change adds two defensive checks:
- Nil the whole flow object hanging off the `portalInfo` while cleaning up the flow.
- Ensure errored portals are properly cleaned up regardless of event state
These gates prevent nil pointer dereferences when resuming portals that have been partially cleaned up due to errors.
Release note: None
Co-authored-by: ZhouXing19 <zhouxing@uchicago.edu>2 files changed
+15
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2598 | 2598 | | |
2599 | 2599 | | |
2600 | 2600 | | |
2601 | | - | |
2602 | | - | |
2603 | 2601 | | |
2604 | 2602 | | |
2605 | 2603 | | |
| |||
2611 | 2609 | | |
2612 | 2610 | | |
2613 | 2611 | | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
2614 | 2623 | | |
2615 | 2624 | | |
2616 | | - | |
2617 | | - | |
2618 | | - | |
2619 | | - | |
2620 | | - | |
2621 | | - | |
2622 | | - | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | 2625 | | |
2627 | 2626 | | |
2628 | 2627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2019 | 2019 | | |
2020 | 2020 | | |
2021 | 2021 | | |
2022 | | - | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
2023 | 2026 | | |
2024 | 2027 | | |
2025 | 2028 | | |
| |||
0 commit comments