Framework: Timeout settings not kill job in queue Laravel 5.4

Created on 13 Jun 2017  路  5Comments  路  Source: laravel/framework

  • Laravel Version: 5.4.25
  • PHP Version: 7.0.15
  • Database Driver & Version:

Description:

Timeout settings not kill job in queue:

# php artisan queue:work --queue=sms --timeout=10 --delay=60 --tries=3
[2017-06-13 16:04:11] Processing: App\Jobs\SendAction
[2017-06-13 16:04:28] Processed:  App\Jobs\SendAction

I also pass timeout in Job:

class SendAction implements ShouldQueue
{
    ....
    public $timeout = 5;
    ....
    public function handle()
    {
        for ($x = 0; $x <= 1000000000; $x++) {
            $b = 1+1;
     } // time for execution 16-18 sec
     ....
}

My config for queue:

    'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 60,
        ],

Steps To Reproduce:

Most helpful comment

You need pcntl php module for this to work... To confirm run:

bash $ php -m | grep pcntl

You should receive pcntl as return.

All 5 comments

You need pcntl php module for this to work... To confirm run:

bash $ php -m | grep pcntl

You should receive pcntl as return.

There is no mention of this on the docs, might be a good addition there.

Timeouts _also_ require PHP 7.1 to work.

Ref: Worker::registerTimeoutHandler
Ref: Worker::supportsAsyncSignals

Thanks!!! Work fine I have already installed pcntl, update php to PHP 7.1.6 and now it works fine, proccess kill and I restart it by Supervisor!

P.S.:I find it worthwhile to describe these queuing requirements in the documentation regarding the version of PHP and installing the pcntl module.

Please open a PR in the docs repo, thanks everyone.

Was this page helpful?
0 / 5 - 0 ratings