Skip to content

[11.x] Fix job not logged in failed_jobs table if timeout occurs within database transaction#54173

Merged
taylorotwell merged 7 commits into
laravel:11.xfrom
decaylala:timeout-job
Jan 17, 2025
Merged

[11.x] Fix job not logged in failed_jobs table if timeout occurs within database transaction#54173
taylorotwell merged 7 commits into
laravel:11.xfrom
decaylala:timeout-job

Conversation

@decaylala

Copy link
Copy Markdown
Contributor

This PR attempts to address #49389

When a job times out with an open database transaction on the same connection as the failed jobs table, rolling back the transaction ensures the failed job is logged correctly. Without this rollback, the transaction remains uncommitted. As a result, database updates are rolled back when the worker process is terminated, preventing the failed job from being saved.

Additionally, this PR ensures that any open database transactions are rolled back to the root level. This guarantees that nested transactions are also properly rolled back; otherwise, the failed job might not be logged in the database.

Comment thread tests/Integration/Database/Queue/Fixtures/TimeOutJobWithTransaction.php Outdated
@decaylala
decaylala requested a review from crynobone January 17, 2025 02:06
@taylorotwell
taylorotwell merged commit 08c2101 into laravel:11.x Jan 17, 2025
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.

3 participants