question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sentry doesn't capture billiard.exceptions.TimeLimitExceeded from Celery

See original GitHub issue

Hi,

I’ve noticed that sentry-sdk doesn’t capture billiard.exceptions.TimeLimitExceeded when a task fails.

I’ve tried Celery 3.1.26 and 4.4. Sentry-sdk is 0.14.1.

Example:

# tasks.py
from time import sleep
from celery import shared_task

@shared_task(time_limit=2)
def test_time_limit():
    sleep(5)

Logs:

[2020-01-30 15:07:59,614: ERROR/MainProcess] Task handler raised error: TimeLimitExceeded(2,)
Traceback (most recent call last):
  File "/Users/mmalysh/Development/my-website/venv/lib/python3.6/site-packages/billiard/pool.py", line 684, in on_hard_timeout
    raise TimeLimitExceeded(job._timeout)
billiard.exceptions.TimeLimitExceeded: TimeLimitExceeded(2,)
[2020-01-30 15:07:59,627: ERROR/MainProcess] Hard time limit (2s) exceeded for api.tasks.test_foobar[e4f46f20-2311-4417-9ade-53e735430c65]

We didn’t have this problem with raven. All other exceptions are reported properly. For example, this exception is reported as expected:

@shared_task
def test_bazqux():
    raise Exception('BUY BITCOIN!')

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
untitakercommented, Jan 30, 2020

Ok! Then let’s close this one, we generally only aim to support stable releases of Celery unless somebody requires more.

0reactions
maxmalyshcommented, Jan 30, 2020

Yes, hard limits work in 4.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Celery integration not capturing error with ... - GitHub
The celery integration is failing to capture the exception when I use a celery factory ... Celery==4.2.1 Flask==1.0.2 sentry-sdk==0.7.4.
Read more >
How to retry celery task on hard timeout? - Stack Overflow
Now in version 4.0 you can specify autoretry for specific exceptions in the decorator. Here is an example from the documentation ...
Read more >
celery.exceptions — Celery 5.2.7 documentation
This exception does not inherit from CeleryError . billiard errors (prefork pool). SoftTimeLimitExceeded. TimeLimitExceeded. WorkerLostError. Terminated.
Read more >
Hard time limit 65s exceeded on Worker 4 - On-Premise
I think the best way would be to build your own image based on the Sentry image and add the certs through a...
Read more >
Celery Documentation - Read the Docs
Celery is easy to use and maintain, and it doesn't need configuration ... The soft time limit allows the task to catch an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found