-
-
Notifications
You must be signed in to change notification settings - Fork 300
feat: Add modules to reload as a global variable #1413
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
base: main
Are you sure you want to change the base?
Conversation
0a0a53c
to
e9f936b
Compare
@dunglas this is not finished yet 😅 and it doesn't work for now but thanks for the early review. I'll remove the draft flag when it's finished. Sorry for the noise |
@dunglas I've made a small PoC not published yet to be able to add module to reload with an environment variable. It works smoothly and solves partially the problem that some extension need to rely on the old PHP request lifecycle to trigger some action (like |
e9f936b
to
8ce5b49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to handle malloc error, at least return a bool in init_modules_to_reload
and handle it where you can like in frankenphp_register_module_to_reload
8ce5b49
to
7900b56
Compare
7900b56
to
f069b7e
Compare
BTW, I was thinking in the shower, and ultimately you could just avoid allocation, so far nobody needed this feature so I doubt there is a need for a lot of space, you could just use a 32 size array and say max is 32. And eventually if people really need more there will ask for it. You could even go for 256 it's not a lot of space for the binary anyway. Also, all your code is NOT thread safe, I don't know if it's matter or not for this context. |
I agree with a fixed size. For the thread's safety, we can declare the struct as a thread local variable but I don't know if it is relevant here because module init (MINIT) is only ran once here |
Couldn't this be implemented directly in the extension by "decorating" (wrapping) the |
@realFlowControl found a way to achieve this for a similar use case without having to add code: DataDog/dd-trace-php#3169 Would that fit your needs? |
Thanks for this PR! Indeed, it fits our needs here, but the |
WIP
We're adding a way to make modules to reload available outside the FrankenPHP (for other extension)
TODO