-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors from queued jobs aren't sent until the queue runner is restarted #222
Comments
@misenhower sorry about the late response. As long as the default transport is used reports should be sent immediately, did you implement the |
Nope, nothing out of the ordinary. I set up a test project here that demonstrates the issue: https://github.com/misenhower/laravel-sentry-test After checking out the repo:
Then add a Sentry DSN inside .env. You can add a job that will throw an exception to the queue with:
If you run the queue worker, it will process and fail the job but the exception won't be reported to Sentry as long as the worker is running:
So that's the issue I'm running into -- failed jobs aren't reported while the queue worker is running. If you hit ctrl+c, it won't report the job either (probably because it isn't a clean exit) and any accumulated reports will be lost. If you tell the queue worker to quit when its queue is empty, then errors will be reported after it finishes processing jobs, right before the worker exits (gracefully):
Let me know if you need any more info or if you're seeing something different! 😃 |
@misenhower you got my attention with this, many thanks! I can reproduce the issue! Going to hunt for a solution! |
Just come across this too - errors occurring in Horizon are not being reported to Sentry. |
@misenhower & @dwightwatson, we have some hurdles not allowing us to implement a proper fix so I crafted up a temporary one until we can fix the base SDK. I would appreciate if you all could take a look at #228 and see if that would solve the issues described in this issue. |
Thanks @stayallive, I'm out of town right now but I will check this out next week. Thanks for all your effort, that seemed to kick off a long chain of comments 😄 |
Yeah this is going to require some effort to really "fix" in the end. But in the meantime the #228 PR is there to get a fix out soon while we work out the details :) |
Hey, sorry for my delay on this. I just tested out the code from #228 with my sample project as well as a real project and it seems to fix the problem in both of them. So everything looks good from what I can see, thanks again for your help! 👍 |
Sorry for disturbing here, but is there anywhere more information about how to do this in Laravel @stayallive ? |
@andre-hh I am not sure what you are asking here. But if you have a question not related to sending errors from a queue until it's restarted please open a new issue with your question so we can follow it better. This issue is fixed in |
I'm wondering if this issue has re-surfaced in Laravel 9. I'm seeing "failed jobs" in the Horizon dashboard that aren't being reported to Sentry. Wondering if anyone from this thread has noticed the same behaviour - perhaps some event names have changed and broken reporting. |
@dwightwatson are you sure the exception with what those jobs failed are not ignored by default (like a
Feel free to open up a new issue with a little more info so we can investigate if needed. |
Yeah - everything in my failed job list should have been reported - all proper exceptions. I'll review closer and open a new issue if I can narrow it down. |
Exceptions from queued background jobs are logged properly, but they only seem to be sent to the remote Sentry server when you manually restart or shut down the queue runner. I assume that's the intended behavior for HTTP requests, but for queue runners it means reports are delayed indefinitely (or lost).
I'm using the Horizon queue runner, but I assume this happens with the basic one as well.
I think this was handled in #153, but the
sendUnsentErrors
method was removed from a later version of sentry-php so I'm not sure what the best method to fix this would be at this point.The text was updated successfully, but these errors were encountered: