Skip to content

Commit

Permalink
Truncate traceback beyond 200kb
Browse files Browse the repository at this point in the history
  • Loading branch information
twin-drill committed Aug 26, 2024
1 parent ebf40a6 commit e969558
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions temporalio/worker/_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,14 @@ def _gen_tb_helper(

thread_frames.reverse()

size = 0
tb = None
for frm in thread_frames:
tb = TracebackType(tb, frm, frm.f_lasti, frm.f_lineno)
size += sys.getsizeof(tb)

while size > 200000 and tb:
size -= sys.getsizeof(tb)
tb = tb.tb_next

return tb

0 comments on commit e969558

Please sign in to comment.