php-resque
php-resque copied to clipboard
pcntl_signal_dispatch(); missing
Careful with this, if you no have this function inside in the while of the worker whenyou generate the signal for shutdown, this never is fired, you have to call this function pcntl_signal_dispatch(); //affected in ubuntu 16.04 (tested)
should be
while (true) { if(function_exists('pcntl_signal_dispatch')) { pcntl_signal_dispatch(); } if ($this->shutdown) { break; }
can you give some references to read and make a PR for this?
@Hikariii in the method work in the workers for example this
public function work()
{
if ($interval !== null) {
$this->interval = $interval;
}
$this->updateProcLine('Starting');
$this->startup();
while (true) {
if (function_exists('pcntl_signal_dispatch')) {
pcntl_signal_dispatch();
}
if ($this->shutdown) {
break;
}
if you no call the dispatch, if you fire a signal this keep waiting until you fire the dispatch for run in php
@spiritdead @Hikariii I was running older version of php-resque and upgrading to PHP7 and found things not working, and suspected I need to do pcntl_signal_dispatch()
, but the issue was that I didn't have this change https://github.com/chrisboulton/php-resque/pull/296
Note that PHP 7.x is not properly supported at this time, so YMMV.
on PHP 7.1, the worker is getting stalled after performing the first job in the Queue. I have added more details here https://github.com/resquebundle/resque/issues/24