Closed sburning closed 7 years ago
I did try to replicate you issue (on OS X), but your example code seemed to work fine for me. So, unfortunately, I cannot offer any workarounds to your problem.
Also, pthreads v2 is no longer supported, and so no further updates will be made to it. So if there is a bug here, then it will not be fixed. If possible, upgrade to PHP 7 so that you can receive the latest bug fixes and features in pthreads v3.
I am using version 2.0.10 of pthreads for php 5.6 ts v11 x64, downloaded from http://windows.php.net/downloads/pecl/releases/pthreads/2.0.10/
I have also tried 2.0.09 with the same result.
I have tried the examples on two different servers with the same result(from event viewer): Faulting application name: php.exe, version: 5.6.24.0, time stamp: 0x57904dc0 Faulting module name: php_pthreads.dll, version: 5.6.0.0, time stamp: 0x542ba166 Exception code: 0xc0000005 Fault offset: 0x0000000000007f2c Faulting process id: 0x1c0c Faulting application start time: 0x01d2dec4df8946c3 Faulting application path: C:\php\php.exe Faulting module path: C:\php\ext\php_pthreads.dll
The CLI will always crash for me when accessing $this->worker. I have tried it from a threaded for a pool and by just extending a worker and a threaded without a pool, both result in the same issue. Here is one of the examples i tried. It crashes at the $this->worker->addData line. I have also tried just setting an id in the worker
$this->id=int(1);
and then accessing it in the threaded$this->worker->id
and it crashes.` class Searcher extends Worker { public $data = [];
}
class SearchGoogle extends \Threaded { public function __construct($query) { $this->query = $query; }
}
// Stack our jobs on our worker $worker = new Searcher(); $searches = ['dogs', 'cats', 'birds']; foreach ($searches as &$search) { $search = new SearchGoogle($search); $worker->stack($search); }
// Start all jobs $worker->start();
// Join all jobs and close worker $worker->shutdown(); foreach ($worker->data as $html) { echo substr($html, 0, 20).PHP_EOL; } `
Any ideas?