Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught FiberError: Cannot suspend in a force-closed fiber #98

Open
EdmondDantes opened this issue Nov 6, 2024 · 1 comment

Comments

@EdmondDantes
Copy link

Sometimes, I encounter an error of this kind.

Environment:

PHP 8.3.4 (cli) (built: Mar 13 2024 11:43:12) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.4, Copyright (c) Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans

Windows 11

Unfortunately, I can’t identify a clear pattern to reproduce this issue.
I’ve looked into the PHP Fiber code a bit and found that the situation occurs if a Fiber is destroyed in a destructor. However... for some reason, the code involving it continues to execute even after the destructor has been called.

I understand that this is a challenging case to capture. So far, I can’t provide more information. I tried to understand the situation through step-by-step debugging, but… I didn’t see anything suspicious. If I could catch the moment when the Fiber destructor is called and see why the code continues after that, I could easily pinpoint the problem. But I don’t know how to catch the destructor call point.

Maybe you know something about this issue. Thank you!

Error occured here:
Revolt\EventLoop\Internal\AbstractDriver

unset($callback, $args);

            if ($this->interrupt) {
                /** @noinspection PhpUnhandledExceptionInspection */
                \Fiber::suspend($this->internalSuspensionMarker);
            }

Trace:

Fatal error: Uncaught FiberError: Cannot suspend in a force-closed fiber in C:\work\ct\ifcastle-amphp-web-server\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php:436
Stack trace:
#0 C:\work\ct\ifcastle-amphp-web-server\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(436): Fiber::suspend(Object(stdClass))
#1 C:\work\ct\ifcastle-amphp-web-server\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(562): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#2 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#3 {main}
  thrown in C:\work\ct\ifcastle-amphp-web-server\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php on line 436

@danog
Copy link
Contributor

danog commented Dec 6, 2024

May be a memory corruption issue, encountering similar issues as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants