laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.87k stars 657 forks source link

Timed out jobs are not reported #1293

Closed paulandroshchuk closed 1 year ago

paulandroshchuk commented 1 year ago

Horizon Version

5.17.0

Laravel Version

10.14.1

PHP Version

8.2.3

Redis Driver

Predis

Redis Version

7.0.9

Database Driver & Version

MySQL Ver 8.0.32 for macos13.0 on arm64 (Homebrew)

Description

Timed out jobs are not reported. It looks like TimeoutExceededException is thrown but for some reason this particular exception is not reported (laravel.log is empty).

There is a way to actually have it reported: define a failed() method within the job and manually report the exception using the report() helper:

public function failed(\Throwable $e)
{
    report($e);
}

If we don't specify this, the exception is not reported, which I think should be, right?

Other exceptions such as: MaxAttemptsExceededException, etc are reported correctly.

I've submitted a bug-report repository: https://github.com/paulandroshchuk/bug-report and also made a Loom video showing the behaviour: https://www.loom.com/share/f5c7a487bf61462b950426915b87e8d7

Steps To Reproduce

  1. Pull bug-report repository https://github.com/paulandroshchuk/bug-report
  2. php artisan hey - queue two jobs (or queue the jobs in any other way)
  3. php artisan horizon - run the jobs (they will time out)
  4. Open laravel.log and you'll see only one time out is reported where two jobs timed out. The reported exception is the one that is manually reported; if it was not reported, it would not be inside laravel.log.
driesvints commented 1 year ago

I'm not sure about this one... would appreciate some help in figuring this one out.

github-actions[bot] commented 1 year ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

paulandroshchuk commented 1 year ago

I'm not sure about this one... would appreciate some help in figuring this one out.

Were you able to reproduce the same behaviour? Do you think this might be a real bug? If so, I think I can spend more time debugging this.

driesvints commented 1 year ago

Actually none of those report for me. I'm using your repo.

Screenshot 2023-07-06 at 10 29 02
paulandroshchuk commented 1 year ago

Actually none of those report for me. I'm using your repo.

Screenshot 2023-07-06 at 10 29 02

Interesting they didn't time out. Do you have this extension installed? https://laravel.com/docs/10.x/queues#timeout

CleanShot 2023-07-06 at 11 36 51@2x
driesvints commented 1 year ago

yep

driesvints commented 1 year ago

With both errors not being reported I believe this is intentionally. So going to close this sorry.

hivokas commented 1 year ago

For anybody who finds this issue, I recommend taking a look at https://github.com/laravel/framework/pull/47107 and https://github.com/laravel/framework/pull/47068.