-
Notifications
You must be signed in to change notification settings - Fork 30
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
Implement custom FiberFactory interface #72
base: main
Are you sure you want to change the base?
Conversation
IMO this should be solved by using the observer API via an extension or FFI instead. |
Hmm, I don't think that bringing in requirements and extensions for what can be easily done via a very simple userland API is appropriate. This functionality is very useful to debug issues like deadlocks or a low mmap limit in field conditions (ie webhosts), where one might not have access to FFI or observer extensions. |
@danog That's kind of the point: It can't be easily done in userland, because you can't control all the places where fibers are created. |
But realistically, an application will only ever create fibers in the context of the (only) event loop. Arguing that this shouldn't be done in userland is like arguing that the TracingDriver shouldn't exist: sure it may not be the solution to all your issues, but it's a very useful help when debugging both in dev mode and in production. |
@danog Do you plan to make the changes we discussed in chat? |
I guess I can make them anyway, and then wait until PHP fixes reflectionfibers before using them. |
Create a FiberFactory interface and DefaultFiberFactory/TracingFiberFactory implementations, to allow to easily track the state of all running fibers, simplifying debugging/searching for fiber leaks.
I've also removed the logic that uselessly created a dummy fiber inside of FiberLocal, replacing it with a simple anonymous class instead (since the $localStorage WeakMap property won't be visible or usable from the outside anyway).