-
-
Notifications
You must be signed in to change notification settings - Fork 15
Doesnt work with PHP7 and ExtEventLoop #9
Comments
Hey thanks for reporting. That is odd, does it output any errors? Can you give this code a try?: <?php
require __DIR__.'/../vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$handler = new \WyriHaximus\React\GuzzlePsr7\HttpClientAdapter($loop);
$client = new \GuzzleHttp\Client([
'base_uri' => 'http://127.0.0.1/fake_web/',
'handler' => \GuzzleHttp\HandlerStack::create($handler),
]);
$client->getAsync('http://127.0.0.1/fake_web/')->then(function ($response) {
$html = (string) $response->getBody();
});
$loop->run(); |
Same result. I tried to debug it, and it looks like this while is runned 4 times than freeze on @$this->eventBase->loop($flags); React\EventLoop\ExtEventLoop.php /**
* {@inheritdoc}
*/
public function run()
{
$this->running = true;
while ($this->running) {
$this->nextTickQueue->tick();
$this->futureTickQueue->tick();
$flags = EventBase::LOOP_ONCE;
if (!$this->running || !$this->nextTickQueue->isEmpty() || !$this->futureTickQueue->isEmpty()) {
$flags |= EventBase::LOOP_NONBLOCK;
} elseif (!$this->streamEvents && !$this->timerEvents->count()) {
break;
}
// @-suppression: https://github.com/reactphp/react/pull/234#discussion-diff-7759616R226
@$this->eventBase->loop($flags);
}
} When I removed @ to get some error messages, but didnt help When I used reactPHP periodicalTimer ($loop->addPeriodicTimer) then loop normally works, but if i tried call Guzzle with React it just free as i mention. |
What error messages did you get when removing the |
No error printed. It just run 3 times while loop in run function in ExtEventLoop.php and then halted on @$this->eventBase->loop($flags); |
Alright installing the extension on php 7 isn't going according to my planning. Will try php 5 now first and venture back into php 7 tomorrow. The issue might also affect php 5. (My box is dual php 5 and 7.) |
Managed to get an environment working to debug this issue in. Can reproduce the issue and conform that the event loop seems to work fine. The main issue I'm running into is that it can't seem to confirm a working stream. Currently debugging that issues. The interesting thing is that looking up DNS records works but something fails when doing the HTTP connection. |
It's been over a year so assuming this isn't an issue any more, if it is please re-open and I'll have a loot at it again. |
I think I may be experiencing this same issue. I'm using this in conjuction with |
@markspare have you updated to the latest version? It contains some hacks to work around that specific hack. P.S. Alternatively I would recommend using https://github.com/clue/reactphp-buzz if you run |
Hi,
I have php 7 installed and I tried only working extension "event.so" for ReactPHP on PHP 7, but it doesnt work at all, it just make php to take 99% cpu power and 'freeze'
Testing code
When I try same code with StreamSelectLoop it works
The text was updated successfully, but these errors were encountered: