amphp / amp

A non-blocking concurrency framework for PHP applications. 🐘

Home Page:https://amphp.org/amp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event loop terminated without resuming the current suspension (the cause is either a fiber deadlock, or an incorrectly unreferenced/canceled watcher)

xpader opened this issue · comments

Error happend when DeferredFuture not consumed.

When the problem first appeared, I spent a long time troubleshooting it.

But finally I found simple code to reproduce it:

<?php

use Amp\DeferredFuture;

require __DIR__.'/vendor/autoload.php';

$def = new DeferredFuture;
echo $def->getFuture()->await();

PHP Fatal error: Uncaught Error: Event loop terminated without resuming the current suspension (the cause is either a fiber deadlock, or an incorrectly unreferenced/canceled watcher): in /home/pader/apps/wind-framework-new/example/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php:122

@xpader What do you expect to happen here?

You are awaiting a value of a future, which never gets completed. Do you have any expected behaviour in mind here?

I don't expect this because it's a bug for me in my program, and I have fixed it.
When php process running over, and there's uncompleted future, I'm now just a little curious it's a bug or design as this.

It's working as intended, but I think the exception message might still not be perfect, so any suggestions are welcome.