-
Notifications
You must be signed in to change notification settings - Fork 29
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
Discard {main} suspension on uncaught exception from loop #71
Conversation
ahem. Hate to be that guy, but... affects. Actually, I love to be that guy. |
No, this affects everything throwing exceptions and using suspensions, because the reference is now retained and cannot be garbage collected, which is even more problematic with exceptions keeping a reference to arguments in the stack trace. |
Not everything throwing exceptions, only those thrown from the event loop. The change is only on the path that would have thrown an Error anyway. Normal throwing of exceptions is unaffected. |
@kelunik Could you have another look at this. Instead of retaining the uncaught exception from the event loop, another |
# Conflicts: # src/EventLoop/Internal/DriverSuspension.php
# Conflicts: # composer.json
If an exception is thrown from the event loop, the suspension for
{main}
will throw "Must call suspend() before calling resume()" because the suspension has been marked as no longer pending before throwing the exception from the loop.event-loop/src/EventLoop/Internal/DriverSuspension.php
Lines 101 to 102 in 81dd825
This PR retains that suspension in the instance of
DriverSuspension
and rethrows the exception from any call toresume()
orthrow()
in the same way as we were already throwing aFiberError
.This new behavior only affects shutdown after an uncaught exception from the event loop and {main} has not been suspended again, which prior to this change was throwing an
Error
, but now will throwUncaughtThrowable
.