Comments (4)
Hey @bpolaszek, thanks for bringing this up 👍
I ran into something similar a while ago in reactphp/socket#283. I would recommend to close everything at the end of your tests (Loop/connections etc.) to avoid leftovers.
I also noticed that you're using an older version of reactphp/async (futureTick
got removed in reactphp/async#32) and reactphp/eventloop (you're using the Facotry::create()
instead of Loop::get()
, refs #226, #229 and #231). Maybe updating to the current versions will do the trick but I don't know for sure.
I hope this helps!
from event-loop.
Hi @SimonFrings,
Thank you for taking some time to look at this.
Regarding react/async, I just upgraded to the latest commit. Now I get a different error, but that's not the point.
How do you close the loop at the end of tests? By calling Loop::close()
?
So, that's what I just did, but a test is still failing when the whole test suite is ran. It doesn't fail when ran alone.
The only way I found to have the test suite running green is to uncomment this line. And I'm using the deprecated Factory::create()
just because Loop::get()
doesn't work, as the latter returns an (already used) singleton instead of a fresh instance.
So, as my problem is to rely on the deprecated Factory::create()
method, how am I supposed to handle this?
from event-loop.
@bpolaszek I agree that this can be cumbersome sometimes, but I concur with everything @SimonFrings said: As a rule of thumb, you should never call Loop::stop()
unless you're absolutely sure there's no alternative.
I understand it's tempting to call Loop::stop()
in tests to interrupt the execution, but what it really means is that there are still listeners attached to the loop that will resume running the next time you call Loop::run()
. As an alternative, I would highly recommend cleaning up any listeners as part of each test. Cleaning up any listeners allows the loop to stop automatically when it has nothing left to do (no timers and streams attached).
You can take a look at the referenced tickets and also #237 for some additional discussion about this. I'm happy to discuss if you feel there's anything else that needs to be done on our end here.
I hope this helps! 👍
from event-loop.
I didn't remember participating in #237 so it looks like that same issue happened to me earlier and I ran into it again! 😅
Well, then I'll first rely on the deprecated Factory::create
until its sunset, as there's no such thing as a "listener collector" (which is, from my POV, the Loop instance's job) we could invoke to clear them all.
Cheers!
from event-loop.
Related Issues (20)
- SIGTSTP not working HOT 4
- Is it possible to export the code of the main loop as a function, so that there is no need to write a callback function. HOT 1
- Manual "tick" execution HOT 11
- Implementations of ::run() use signals->isEmpty() which prevents exiting HOT 3
- PHP8: Uncaught ValueError: No stream arrays wered pased in StreamSelectLoop:: HOT 8
- Loop signals in PHP8 HOT 4
- Infinite recursion bug with timers HOT 6
- How to update the time Interval dynamically? HOT 2
- Periodic timer jumping from one value to another directly. HOT 2
- Experiencing issue with addPeriodicTimer seemingly just stopping randomly HOT 5
- periodic timer with the interval of zero HOT 4
- Rollback the deprecation of the Factory::create method HOT 7
- Question: error missing from register_shutdown_function when using implicit loop vs explicit loop. HOT 2
- [Help] Writing PHPUnit tests - Laravel HOT 3
- Deprecated: Implicit conversion from float 4995090.007781982 to int loses precision in vendor\react\event-loop\React\EventLoop\StreamSelectLoop.php on line 137 HOT 3
- Watchdog timers HOT 3
- Have a look here HOT 3
- How to aggregate data processed in parallel with pcntl HOT 4
- Roadmap to reactphp/event-loop v3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from event-loop.