Skip to content
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

[10.x] Throw timeoutException instead of maxAttemptsExceededException when a job times out #46968

Conversation

PrinsFrank
Copy link
Contributor

@PrinsFrank PrinsFrank commented May 5, 2023

Currently, both when a job times out and when the max attempts are exceeded for a job the maxAttemptsExceeded exception is thrown. This makes debugging job timeouts difficult. This PR adds a new exception that is thrown when the SIGALRM signal is fired.

@PrinsFrank PrinsFrank changed the title Throw timeoutException instead of maxAttemptsExceededException when a job times out [11.x] Throw timeoutException instead of maxAttemptsExceededException when a job times out May 5, 2023
@ankurk91
Copy link
Contributor

ankurk91 commented May 5, 2023

This will be a huge help.

Why can't it go to v10 branch?

@ghost ghost force-pushed the timeout-exception-vs-max-attempts-exception branch from 2bd41ee to b3a1143 Compare May 5, 2023 14:11
@PrinsFrank PrinsFrank changed the base branch from master to 10.x May 5, 2023 14:11
@PrinsFrank PrinsFrank changed the title [11.x] Throw timeoutException instead of maxAttemptsExceededException when a job times out [10.x] Throw timeoutException instead of maxAttemptsExceededException when a job times out May 5, 2023
@taylorotwell taylorotwell merged commit 476f3b5 into laravel:10.x May 8, 2023
15 checks passed
@SlyDave
Copy link

SlyDave commented May 12, 2023

Why did this go into the v10 branch? It's a breaking change...

@driesvints
Copy link
Member

@SlyDave how did this break your app?

@SlyDave
Copy link

SlyDave commented May 12, 2023

Ah I now see the extremely weird decision to make TimeoutExceededException extend MaxAttemptsExceededException. 🤣

I guess that works to handle the breaking change of introducing a new Exception, but it's hard to see how Timeout extends MaxAttempts, maybe a new base Exception in v11, or just remove the extend, both would be breaking.

@driesvints
Copy link
Member

I still don't understand how this breaks your app?

milwad-dev pushed a commit to milwad-dev/framework that referenced this pull request May 12, 2023
… when a job times out (laravel#46968)

* Throw timeoutException instead of maxAttemptsExceededException when a job times out

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
@SlyDave
Copy link

SlyDave commented May 15, 2023

It doesn't, as I noted, because of the TimeoutExceededException extending the MaxAttemptsExceeededException.

I incorrectly made the assumption that a new Exception was being added, that would be a breaking change, instead one was added that extends the existing one, which does stop the breaking change from occurring, but is really weird as it's utterly unrelated, and just serves to cause confusion in future.

If one captures only MaxAttemptsExceeededException, it will capture TimeoutExceededException as well, which is current behaviour but I would argue is unintended behaviour that shouldn't be preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants