Skip to content

Commit 7276929

Browse files
committed
Fix broker sliver leak: always relinquish ticket on close
Move do_relinquish() from except to finally block in both the BlockedJoin close path and the probe_pending() Closing path so the Broker is notified regardless of whether the Authority close RPC succeeds or fails. do_relinquish() is idempotent so the duplicate call in update_lease(CloseWait) is safe.
1 parent 650283d commit 7276929

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

fabric_cf/actor/core/kernel/reservation_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ def close(self, force: bool = False):
759759
self.logger.error(traceback.format_exc())
760760
self.transition(prefix="close", state=ReservationStates.Closed,
761761
pending=ReservationPendingStates.None_)
762+
finally:
762763
self.do_relinquish()
763764
else:
764765
self.transition_with_join(prefix="close", state=ReservationStates.Active,
@@ -1272,8 +1273,10 @@ def probe_pending(self):
12721273
# unreachable, it might be better to retry.
12731274
self.transition(prefix=self.CLOSE_COMPLETE, state=ReservationStates.Closed,
12741275
pending=ReservationPendingStates.None_)
1275-
# Note: the broker does not have information to ensure we
1276-
# are not cheating
1276+
finally:
1277+
# Always notify the Broker to release ticketed resources.
1278+
# do_relinquish() is idempotent (guarded by self.relinquished flag),
1279+
# so it is safe to call here even if update_lease() later calls it again.
12771280
self.do_relinquish()
12781281

12791282
def set_policy(self, *, policy: ABCClientPolicy):

0 commit comments

Comments
 (0)