Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Charrua's avatar

Scheduler running strange

Hello I have a really strange issue in scheduler, sometimes runs the same task for two or three times.. I don't really know what is happening, if there is a server issue or anything else...

This is my simple scheduler code:

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [

    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        
        $schedule->call(function () {
            return true;
        })->everyMinute()->emailOutputTo('...')->thenPing('https://cronhub.io/ping/af709030-c0e8-11e8-9b2f-ff58704a871a');

    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }


}

The last outputs was:

And the issue is when running scheduler at a digital ocean server, if I run it locally no problems. Any ideas?

19.06
19.07
19.08
19.09
19.10
19.11
19.12
19.13

19.16
19.16
19.16

19.17
19.18

19.21
19.21
19.21

19.22
19.23

19.25
19.25

19.26
0 likes
3 replies
Snapey's avatar

so its not missing any, but is queuing somewhere?

eg,

19.17   17
19.18   18

19.21   19
19.21   20
19.21   21

So the tasks for 19 and 20 ran but the output was not recieved until 19:21 . Are you queuing email?

Charrua's avatar

@Snapey I agree with you is like queuing somewhere, I'm not queuing mail, and if you see the code I'm using thenPing() function and the time registry in cronhub (cron monitor) is the same.

Charrua's avatar
Charrua
OP
Best Answer
Level 3

The issue was caused by depleted entropy by PHP script.

To resolve the issue generate entropy by using haveged daemon:

Enable EPEL repository: yum install epel-release

Install daemon with the following command and enable it: yum install haveged

chkconfig haveged on

systemctl start haveged

Please or to participate in this conversation.