workerman icon indicating copy to clipboard operation
workerman copied to clipboard

worker is not restarting when error happens (Windows)

Open varivan opened this issue 3 years ago • 3 comments

When error throws in worker - it not restarting (Windows). To reproduce - declare this callback and run in daemon mode:

// Emitted when worker starts
$ws_worker->onWorkerStart = function () {
    notExistedFunction();
};

It will throw an error and finish service at all, but auto restart is expected

varivan avatar Sep 23 '22 15:09 varivan

Workman does not support this feature under Windows. Please use Linux system. Or you can try to use similar codes to monitor the process

$cmd = 'php start.php';

function popen_processes($cmd)
{
    $descriptorspec = [STDIN, STDOUT, STDOUT];
    $resource = proc_open($cmd, $descriptorspec, $pipes);
    if (!$resource) {
        exit("Can not execute $cmd\r\n");
    }
    return $resource;
}

$resource = popen_processes($cmd);
while (1) {
    sleep(1);
    $status = proc_get_status($resource);
    if (!$status['running']) {
        proc_close($resource);
        $resource = popen_processes($process_files);
    }
}

walkor avatar Sep 24 '22 04:09 walkor

Thank you for your reply. This issue was happens when I migrate from Workeman ver (3.5.6) to this version (4.1.3). In version 3.5.6 this feature was worked perfectly. Do you remove support this feature?

varivan avatar Sep 24 '22 12:09 varivan

Do you remove support this feature?

Yes, this feature removed

walkor avatar Sep 25 '22 10:09 walkor