Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcntl_signal_dispatch(); missing #333

Open
spiritdead opened this issue Mar 25, 2017 · 5 comments
Open

pcntl_signal_dispatch(); missing #333

spiritdead opened this issue Mar 25, 2017 · 5 comments

Comments

@spiritdead
Copy link

spiritdead commented Mar 25, 2017

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;
}

@Hikariii
Copy link

can you give some references to read and make a PR for this?

@spiritdead
Copy link
Author

spiritdead commented Apr 13, 2017

@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

@agentile
Copy link

agentile commented May 5, 2017

@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 #296

@danhunsaker
Copy link
Contributor

Note that PHP 7.x is not properly supported at this time, so YMMV.

@vamsiikrishna
Copy link

on PHP 7.1, the worker is getting stalled after performing the first job in the Queue.
I have added more details here resquebundle/resque#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants