Skip to content

Cron monitors intermittently timing out as incomplete when the job runs successfully #5423

@mlazar-endear

Description

@mlazar-endear

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.50.0

Steps to Reproduce

I think I am seeing the same issue as these unresolved tickets

I have a django project and I'm using huey to schedule and run nightly jobs using Huey.periodic_task. I have wrapped my task functions with sentry_sdk.monitor() and I'm also separately tracking the task status in my own database using huey's pre-execute and post-execute signals.

I have several dozen cron monitors instrumented this way. I am observing that the tasks that take a long-ish time to run are intermittently timing out as "incomplete" in sentry even though I can see the task has finished successfully on my end, and the runtime is within the max runtime configured for the monitor.

Here's an example of a monitor with a 120 minute runtime

Image

versus my own logging

Image

You can see on the 28th and 30th the task ran over the max runtime threshold and was correctly flagged as a timeout after many hours. But on days where the duration is missing in sentry, the task is incorrectly marked as a timeout.

Here's another example of a task running in a different environment. This monitor also has a max runtime of 120 minutes. In this case, the runtimes on the 26th and 27 were short (<15 minutes) but were still marked as a timeout in sentry.

Image Image

Expected Result

The cron monitor status and duration should be consistently reported in Sentry.

Actual Result

Cron monitors are intermittently timing out as incomplete.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions