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

Integrity constraint violation on failed_jobs_uuid_unique #53230

Open
bytestream opened this issue Oct 18, 2024 · 1 comment · May be fixed by #53264
Open

Integrity constraint violation on failed_jobs_uuid_unique #53230

bytestream opened this issue Oct 18, 2024 · 1 comment · May be fixed by #53264

Comments

@bytestream
Copy link
Contributor

Laravel Version

11.28.1

PHP Version

8.3.12

Database Driver & Version

No response

Description

Calling Artisan::call('queue:work') multiple times results in the JobFailed event listener being bound multiple times. As a result of that logFailedJob() being called multiple times and when combined with the DatabaseUuidFailedJobProvider results in an exception being thrown:

Integrity constraint violation: 1062 Duplicate entry '414b6d4b-416e-4eb6-b5e5-9491c36d5146' for key 'failed_jobs.failed_jobs_uuid_unique'

There is a history of that exception and I suspect this is the reason.

Steps To Reproduce

    public function testArtisanCallQueueWork(): void
    {
        $event = \Illuminate\Support\Facades\Event::fake();

        $this->artisan('queue:work', ['--once' => true]);
        $this->artisan('queue:work', ['--once' => true]);

        $this->assertSame(1, count($event->dispatcher->getListeners(\Illuminate\Queue\Events\JobFailed::class)));
    }
Copy link

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!

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

Successfully merging a pull request may close this issue.

2 participants