amphp / amp

A non-blocking concurrency framework for PHP applications. 🐘
https://amphp.org/amp
MIT License
4.25k stars 257 forks source link

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

Closed xpader closed 1 year ago

xpader commented 1 year ago

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

bwoebi commented 1 year ago

@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?

xpader commented 1 year ago

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.

kelunik commented 1 year ago

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