Skip to content

horizon:restart command fails #1388

Closed
Closed
@sebastiaanluca

Description

@sebastiaanluca

Horizon Version

5.23.0

Laravel Version

10.44.0

PHP Version

8.2.15

Redis Driver

PhpRedis

Redis Version

2.2.2

Database Driver & Version

mysql Ver 8.1.0 for macos14.0 on arm64 (Homebrew)

Description

It seems #1387 broke the output of the php artisan horizon:restart command (and maybe others).

We restart Horizon every so often via a scheduled job and after the update from yesterday we've been getting these in production. So it's interpreting the status message as output instead of the status code?

Confirmed it still works on v5.22.1.

The exceptions:

RuntimeException
Horizon returned an unknown status "   INFO  Horizon is running.  " and could not be restarted.

    protected $description = "Restart Horizon if it's currently running";
    public function handle(): int
    {
        if (! $this->isSupportedStatus($status = $this->getHorizonStatus())) {
            throw new RuntimeException(sprintf('Horizon returned an unknown status "%s" and could not be restarted.', $status));
        }
        if ($status !== 'Horizon is running.') {
            return static::SUCCESS;
        }
App\Exceptions\ScheduledCommandException
The scheduled command `'/usr/bin/php8.2' 'artisan' horizon:restart` failed to complete successfully. 
In RestartHorizon.php line 29:
                                                                               
  Horizon returned an unknown status "   INFO  Horizon is running.  " and cou  
  ld not be restarted.       

    {
        $output = file_exists($event->output)
            ? file_get_contents($event->output)
            : 'No output found.';
        return new self(sprintf(
            'The scheduled command `%s` failed to complete successfully. %s',
            $event->command ?? $event->description,
            $output,
        ));
    }

Steps To Reproduce

In one terminal shell:

php artisan horizon

In another:

php artisan horizon:restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions