laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.45k stars 11k forks source link

Duplicate schedule command #52929

Closed fouteox closed 1 month ago

fouteox commented 1 month ago

Laravel Version

11.24.1

PHP Version

8.3.11

Database Driver & Version

MySQL 8.0.36 for macOS 15.0 on arm64 (Herd)

Description

The command "php artisan schedule:work" executes duplicate commands

Steps To Reproduce

Clone : https://github.com/fouteox/twice-command-laravel

Run : php artisan schedule:work

Look the output.

crynobone commented 1 month ago

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

fouteox commented 1 month ago

I added the repository in my first post.

I'm surprised so few people are impacted.

BassemN commented 1 month ago

I am facing the same issue. Everything was working well up to version 11.23.5. As a workaround, I downgraded the framework to 11.23.5 until the issue is resolved.

sebastiaands commented 1 month ago

Same issue here for commands that are scheduled using Forge. In 11.24.0 none of the scheduled commands ran, in 11.24.1 all of them run twice.

Smartoptics-jesper commented 1 month ago

Same issue here, but I also did a fresh Laravel 11 install and directly run php artisan schedule:list and it shows twice so it seems like a generic bug and not related to any specific custom projects.

php artisan schedule:list

0 php artisan inspire ..................................................................................................................................................................................................................................................................................................................................... Next Due: 51 minutes from now
0 php artisan inspire ..................................................................................................................................................................................................................................................................................................................................... Next Due: 51 minutes from now

hettiger commented 1 month ago

Same problem here. I also verified it actually executes twice. Thought, it might just be duplicate output or something. However, it really does execute twice:

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class TestCommand extends Command
{
    protected $signature = 'app:test';

    protected $description = 'Command description';

    public function handle()
    {
        logger()->info('did execute test command');
    }
}
// console.php

// …

\Illuminate\Support\Facades\Schedule::command('app:test')->everyMinute();
// laravel.log after `php artisan schedule:run` for ~2 seconds

[2024-09-26 07:58:39] local.INFO: did execute test command  
[2024-09-26 07:58:40] local.INFO: did execute test command  
Dependencies / exact Versions
brick/math:0.12.1
carbonphp/carbon-doctrine-types:3.2.0
dflydev/dot-access-data:v3.0.3
doctrine/inflector:2.0.10
doctrine/lexer:3.0.1
dragonmantank/cron-expression:v3.3.3
egulias/email-validator:4.0.2
fruitcake/php-cors:v1.3.0
graham-campbell/result-type:v1.1.3
guzzlehttp/guzzle:7.9.2
guzzlehttp/promises:2.0.3
guzzlehttp/psr7:2.7.0
guzzlehttp/uri-template:v1.0.3
laravel/framework:v11.24.1
laravel/prompts:v0.2.1
laravel/serializable-closure:v1.3.5
laravel/tinker:v2.10.0
league/commonmark:2.5.3
league/config:v1.2.0
league/flysystem:3.28.0
league/flysystem-local:3.28.0
league/mime-type-detection:1.16.0
monolog/monolog:3.7.0
nesbot/carbon:3.8.0
nette/schema:v1.3.0
nette/utils:v4.0.5
nikic/php-parser:v5.2.0
nunomaduro/termwind:v2.1.0
phpoption/phpoption:1.9.3
psr/clock:1.0.0
psr/container:2.0.2
psr/event-dispatcher:1.0.0
psr/http-client:1.0.3
psr/http-factory:1.1.0
psr/http-message:2.0
psr/log:3.0.2
psr/simple-cache:3.0.0
psy/psysh:v0.12.4
ralouphie/getallheaders:3.0.3
ramsey/collection:2.0.0
ramsey/uuid:4.7.6
symfony/clock:v7.1.1
symfony/console:v7.1.5
symfony/css-selector:v7.1.1
symfony/deprecation-contracts:v3.5.0
symfony/error-handler:v7.1.3
symfony/event-dispatcher:v7.1.1
symfony/event-dispatcher-contracts:v3.5.0
symfony/finder:v7.1.4
symfony/http-foundation:v7.1.5
symfony/http-kernel:v7.1.5
symfony/mailer:v7.1.5
symfony/mime:v7.1.5
symfony/polyfill-ctype:v1.31.0
symfony/polyfill-intl-grapheme:v1.31.0
symfony/polyfill-intl-idn:v1.31.0
symfony/polyfill-intl-normalizer:v1.31.0
symfony/polyfill-mbstring:v1.31.0
symfony/polyfill-php80:v1.31.0
symfony/polyfill-php83:v1.31.0
symfony/polyfill-uuid:v1.31.0
symfony/process:v7.1.5
symfony/routing:v7.1.4
symfony/service-contracts:v3.5.0
symfony/string:v7.1.5
symfony/translation:v7.1.5
symfony/translation-contracts:v3.5.0
symfony/uid:v7.1.5
symfony/var-dumper:v7.1.5
tijsverkoyen/css-to-inline-styles:v2.2.7
vlucas/phpdotenv:v5.6.1
voku/portable-ascii:2.0.1
webmozart/assert:1.11.0
crynobone commented 1 month ago

v11.25.0 has been released with revert the breaking change PR.