Description
Hey there! 👋
I stumbled upon a kinda weird bug when using the loop in my CI, where some tests sometimes perform Loop::stop()
when some others launch Loop::run()
(though they don't run concurrently). This leads to fatal errors as raised here, although they would not be raised when running tests one by one. 🤨
I absolutely don't know how this is handled in the background as the fiber thing is kinda too low level to me, but it looks like the loop is sometimes left in some sort of stale state (which is not supposed to happen in production, as the loop presumably runs once). 🧐
Spawning a new loop before each test is easy to do and turns the tests to green, except it relies on deprecated code. Do you know a better way to handle this? Otherwise would it be relevant to add a Loop::reset()
method? 💡
As a side-feature-request, a Loop::isRunning()
method would be a great help to avoid this kind of tricks (yeah, this method can be invoked from an X-Framework app as well as from a regular PHP app, meaning the loop, in this case, just has to run to execute the promise and stop immediately afterwards) because we cannot know, from the outside, whether the loop is actually running or not.
Thanks! 🙏
Ben