You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CeleryIntegration with Redbeat scheduler seems to send 2 In Progress Check ins leading 1 to Timeout #4392
It seems like the celery integration used with the Redbeat scheduler is creating two in-progress check in events at the scheduled time. The worker only sends 1 OK check-in event leading to the other in-progress event to timeout. I was able to reproduce this with a task that runs every minute.
Using the celery beat scheduler instead of redbeat works as expected.
changed the title [-]CeleryIntegration with Redbeat scheduler seems to send 2 In Progress Check ins[/-][+]CeleryIntegration with Redbeat scheduler seems to send 2 In Progress Check ins leading 1 to Timeout[/+]on May 14, 2025
I have now tested by disabling celery-redbeat in my test project, using the default celery scheduler (celery.beat.PersistentScheduler) and I get the same result. So this issue is affecting more people then just redbeat users.
This looks like possible double instrumentation to me.
Is it possible you're using both monitor_beat_tasks=Trueand wrapping the tasks in the @sentry_sdk.monitor decorator? They are mutually exclusively per my understanding -- i.e., you either let Sentry monitor all beat tasks automagically, or you let it monitor none and you hand-pick whichever you want with the decorator.
As far as I can tell, the problem is that we're patching redbeat's maybe_due and sending an in-progress check-in there, even though maybe_due might not end up actually scheduling the task if it determines it's not supposed to run. Fix here: #4395
Activity
[-]CeleryIntegration with Redbeat scheduler seems to send 2 In Progress Check ins[/-][+]CeleryIntegration with Redbeat scheduler seems to send 2 In Progress Check ins leading 1 to Timeout[/+]antonpirker commentedon May 15, 2025
Hey @Fwang36 thanks for the great issue description! I will have a look
antonpirker commentedon May 15, 2025
I have now reproduced your error:
in_progressfor my task with the checkin-ida.in_progressfor my task with the checkin-idb,okcheckin with checkin-idb,okcheckin with checkin-ida.That is the project I used: https://github.com/antonpirker/testing-sentry/tree/main/test-celery-redbeat
So clearly something is off. I prioritize this fix. I'll keep you posted, sometime next we should have this fixed.
antonpirker commentedon May 15, 2025
Here my
beatlog:Here my
celery workerlog:antonpirker commentedon May 15, 2025
I have now tested by disabling
celery-redbeatin my test project, using the default celery scheduler (celery.beat.PersistentScheduler) and I get the same result. So this issue is affecting more people then just redbeat users.sentrivana commentedon May 15, 2025
This looks like possible double instrumentation to me.
Is it possible you're using both
monitor_beat_tasks=Trueand wrapping the tasks in the@sentry_sdk.monitordecorator? They are mutually exclusively per my understanding -- i.e., you either let Sentry monitor all beat tasks automagically, or you let it monitor none and you hand-pick whichever you want with the decorator.sentrivana commentedon May 15, 2025
Nevermind, I get the extra
in_progresscheck-in too. Looking into this.sentrivana commentedon May 16, 2025
As far as I can tell, the problem is that we're patching redbeat's
maybe_dueand sending an in-progress check-in there, even thoughmaybe_duemight not end up actually scheduling the task if it determines it's not supposed to run. Fix here: #4395We can cut a release with this next week.
antonpirker commentedon May 19, 2025
Small related docs update: getsentry/sentry-docs#13751
fix(celery): Do not send extra check-in (#4395)
sentrivana commentedon May 19, 2025
The fix for this is now out in 2.29.0!