Skip to content

Commit

Permalink
Add stack trace to logs, when service cancelled 2x
Browse files Browse the repository at this point in the history
This can be a sign that some caller isn't properly managing the
cancellation cycle. But... maybe we should just quietly allow double
cancellations? I think not, at least yet, because it still seems to be
uncovering bugs, when we hunt it down.
  • Loading branch information
carver committed Dec 5, 2019
1 parent 9ff9e63 commit ee27212
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions p2p/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def _log_tasks(self, message: str) -> None:
def cancel_nowait(self) -> None:
if self.is_cancelled:
self.logger.warning("Tried to cancel %s, but it was already cancelled", self)
self.logger.debug("Second cancellation of %s: stack trace", self, stack_info=True)
return
elif not self.is_running:
raise ValidationError("Cannot cancel a service that has not been started")
Expand Down

0 comments on commit ee27212

Please sign in to comment.