[php-src] Issue #11389: Allow suspending fibers in destructors
| From: | nicolas-grekas | Date: | Wed, 07 Jun 2023 09:20:30 +0000 |
| Subject: | [php-src] Issue #11389: Allow suspending fibers in destructors | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244614@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11389
Author: nicolas-grekas
### Description
Right now, when trying to suspend the current fiber in a destructor, the engine throws "Cannot
switch fibers in current execution context".
This has been discussed a bit with @trowski and @kelunik in https://github.com/nicolas-grekas/symfony/pull/43#pullrequestreview-1426674302
From that discussion, the reason is that the garbage collector would need to be made safe for
re-entry from multiple fibers.
Not being able to do i/o (which is what fibers are most useful for) in destructors kinda
reintroduces the “What color is your function?” problem, which fibers were designed to avoid.
I totally get that this might be challenging, but this limitation should be removed if possible.
:pray: