Skip to content

Celery exceptions cause error in capture_stacktrace #708

Description

@tim-schilling

The latest version of celery, 5.2.1, raises some exceptions in an unexpected way.

For this particular case, tb was a string of value:

'Traceback (most recent call last):\n  File "/app/.heroku/python/lib/python3.9/site-packages/billiard/pool.py", line 366, in workloop\n    put((READY, (job, i, result, inqW_fd)))\n  File "/app/.heroku/python/lib/python3.9/site-packages/billiard/queues.py", line 366, in put\n    self.send_payload(ForkingPickler.dumps(obj))\n  File "/app/.heroku/python/lib/python3.9/site-packages/billiard/reduction.py", line 56, in dumps\n    cls(buf, protocol).dump(obj)\nbilliard.pool.MaybeEncodingError: Error sending res...'

Stacktrace of error

AttributeError: 'str' object has no attribute 'tb_frame'
  File "celery/utils/dispatch/signal.py", line 276, in send
    response = receiver(signal=self, sender=sender, **named)
  File "scout_apm/celery.py", line 114, in task_failure_callback
    ErrorMonitor.send(
  File "scout_apm/core/error.py", line 69, in send
    for frame in capture_stacktrace(traceback)
  File "scout_apm/core/backtrace.py", line 132, in capture_stacktrace
    return list(reversed(list(itertools.islice(walker, LIMIT))))
  File "scout_apm/core/backtrace.py", line 75, in stacktrace_walker
    for frame, lineno in traceback.walk_tb(tb):
  File "traceback.py", line 312, in walk_tb
    yield tb.tb_frame, tb.tb_lineno

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions