Skip to content

Commit

Permalink
Merge pull request #7614 from kozlovsky/fix/7600_type_error_in_print_…
Browse files Browse the repository at this point in the history
…stack

Fixes #7600: handle exceptions in task.print_stack()
  • Loading branch information
kozlovsky authored Oct 2, 2023
2 parents e547c08 + 26bf1bc commit 54c3331
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tribler/core/utilities/slow_coro_detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def format_info(handle: Handle, include_stack: bool = False, stack_cut_duration:

if not main_stack_tracking_is_enabled():
stream = io.StringIO()
task.print_stack(limit=limit, file=stream)
stack = stream.getvalue()
try:
task.print_stack(limit=limit, file=stream)
except Exception as e: # pylint: disable=broad-except
stack = f'Stack is unavailable: {e.__class__.__name__}: {e}'
else:
stack = stream.getvalue()
else:
stack = get_main_thread_stack(stack_cut_duration, limit, enable_profiling_tip)
return f"{task}\n{stack}"

0 comments on commit 54c3331

Please sign in to comment.