-
Notifications
You must be signed in to change notification settings - Fork 83
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
FrankenPHP support #258
Comments
It looks similar to this use case https://github.com/NoiseByNorthwest/php-spx?tab=readme-ov-file#handle-long-living--daemon-processes With custom metadata for request related information https://github.com/NoiseByNorthwest/php-spx?tab=readme-ov-file#add-custom-metadata-to-the-current-full-report With these 2 features it will work although it won't be perfect. |
Thank you for the direction. Unfortunately, when I try to build the extension, I get the following error:
So, I guess frankenphp is not supported. |
Sorry I forgot that FrankenPHP embeds a ZTS PHP. |
Unfortunately, I cannot help with reviews but willing to test locally and in the staging environment if it works ok. |
@SpartakusMd could you please test with this branch #260 ? |
Hello, sorry for late reply. The build runs successfully but I receive the following when running
|
I looks like it is loaded as a Zend extension (i.e. |
My bad 🫣 Got it running. But it crashes the process whenever I open a report from the list: ex How can I extract something useful to investigate the issue? |
A stack trace obtained from coredump + gdb ? |
@NoiseByNorthwest As requested, I've created a repro repository: https://github.com/tigitz/franken-php-spx, including the Dockerfile. On my side, I don't encounter any crashes when visiting https://localhost/?SPX_KEY=dev&SPX_UI_URI=/. However, nothing seems to happen. Looking forward to the subtle tweaks that will make SPX fully enjoyable in a FrankenPHP environment! |
Thanks @tigitz, I currently reproduce the "nothing happen" behavior, I will spend more time on it this weekend. I'll also have to make some changes to your reproducer since the SPX config is incomplete as you can see on the phpinfo() screenshot below |
I reproduce the segfault. Here is the backtrace
So This function pointer is nullified by Below is what it causes (nullified at the end of a request and called right after by another thread / request processing):
BTW somewhat related to xdebug/xdebug#958 Regarding these hooks, this seems at first glance to be an oversight as other hooks are correctly touched by The issue seems to be more related to the fact that the various states related to these hooks are stored in I'll try to fix it with a thread-local storage. |
@SpartakusMd @tigitz the segfault on HTTP side is fixed. |
@NoiseByNorthwest Thanks a lot! I'll give it a try in an hour or two and confirm. Are there any specific SPX directives I should configure for my tests? Or is it just about accessing https://localhost/?SPX_KEY=dev&SPX_UI_URI=/ ? |
@tigitz I'll make a PR to your reproducer |
@NoiseByNorthwest I can confirm it now works as expected in non-worker mode, thank you! This mode aligns with my development and profiling workflow so it suits my use case perfectly. However those looking to profile in worker mode (commonly used for production profiling) might still encounter an issue where I've provided a reproducer here: https://github.com/tigitz/frankenphp-demo-spx |
@tigitz using https://github.com/tigitz/franken-php-spx I've no issue for profiling the Symfony demo app and accessing the web UI |
@NoiseByNorthwest While using FrankenPHP's worker mode that I mentioned ? Because otherwise yes it works fine in non worker mode. I’ve created a separate reproduction based on FrankenPHP’s production demo to ensure my minimal app isn’t overly simplistic for worker mode. |
Sorry I've missed that point, I'll try to debug the worker mode case next week end. |
@tigitz the web UI cannot be served by FrankenPHP in worker mode since this mode is an execution model where a single PHP script serves many HTTP requests. SPX needs an execution model where a single script execution (RINIT/RSHUTDOWN boundaries) serves one request. So it works with FPM, mod_php or even with PHP's embedded server, but it cannot work with runtimes such as FrankenPHP, Swoole, Roadrunner... As a workaround, you can use php-fpm to serve the web UI, and make sure that SPX's data directory is shared between php-fpm and FrankenPHP. |
That makes sense. Honestly, the easiest way would be to temporarily disable worker mode and run the profiler on it. If I decide to profile in production, that’s exactly what I’ll do. Thanks for making it possible to profile outside worker mode in the first place, it’s a huge improvement for tackling my day-to-day performance issues! I think issue can be closed now. 🙂 |
@SpartakusMd Is everything OK for you ? Can this issue be closed ? |
@NoiseByNorthwest yeah, all good. Thank you for the improvements made. I will also disable worker mode when doing debugging. |
Is there any way to make it work under FrankenPHP worker mode?
The text was updated successfully, but these errors were encountered: