Commit 37e2e7c
committed
fix: snapshot IsBusy state to prevent TOCTOU panic in partitionHealthy and release callReq+stream on addCall failure
partitionHealthy: IsBusy() reads a live atomic in-flight counter.
Calling it twice (counting pass + placement pass) creates a TOCTOU
race: if hosts flip from healthy to busy between passes, the placement
indices can overflow past the slice bounds causing an index-out-of-range
panic. Fix by snapshotting the busy state once per host in pass 1 and
reusing it in pass 2, using a small stack buffer for the common case.
exec: when addCall() fails, the callReq obtained from the pool and
the reserved stream ID were leaked. Fix by clearing the stream and
returning the callReq to the pool before returning the error.1 parent b8edd55 commit 37e2e7c
2 files changed
+19
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1226 | 1226 | | |
1227 | 1227 | | |
1228 | 1228 | | |
| 1229 | + | |
| 1230 | + | |
1229 | 1231 | | |
1230 | 1232 | | |
1231 | 1233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
772 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
773 | 784 | | |
774 | | - | |
775 | | - | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
776 | 788 | | |
777 | 789 | | |
778 | 790 | | |
| |||
792 | 804 | | |
793 | 805 | | |
794 | 806 | | |
795 | | - | |
796 | | - | |
| 807 | + | |
| 808 | + | |
797 | 809 | | |
798 | 810 | | |
799 | 811 | | |
| |||
0 commit comments