-
Notifications
You must be signed in to change notification settings - Fork 270
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
Asyncify Crash in the Woocommerce onboarding flow #1078
Comments
I was able to recreate the issue locally. But after running |
Weird @bgrgicak! Is there any chance it only happens in the kitchen sink bundle or with networking enabled? It could also be slightly non-deterministic, I remember successfully configuring woo in the past. |
I'm not sure why is this happening, but I had the same experience with PHP 8.1. I was able to recreate it until I rebuilt PHP. Then it stopped. It also looks like these errors aren't producing crashes, Woo keeps running after the error, but it's slow. @adamziel would you have some time to pair on this? |
Sure, let's pair on Monday. |
I reproduced this issue with a PHP build that retains the function names, here's the stack trace I got:
|
Fixes #1078 ## What is this PR doing? If fixes an Asyncify error and memory leak when running PHP shutdown functions. ## What problem is it solving? It adds full support for PHP shutdown functions and prevents crashes. ## How is the problem addressed? By adding Asyncify support for `wasm_sapi_request_shutdown` and preventing `free` from running if memory wasn't allocated. ## Testing Instructions - Checkout this branch - Run dev env `npm run dev` - [Open this URL](http://localhost:5400/website-server/?php=8.0&wp=latest&storage=none&networking=yes#{%20%22landingPage%22:%20%22/wp-admin/%22,%20%22features%22:%20{%20%22networking%22:%20true%20},%20%22steps%22:%20[%20{%20%22step%22:%20%22login%22%20},%20{%20%22step%22:%20%22writeFile%22,%20%22path%22:%20%22/wordpress/wp-content/mu-plugins/rewrite.php%22,%20%22data%22:%20%22%3C?php%20add_action(%20'shutdown',%20function()%20{%20post_message_to_js('test');%20}%20);%22%20}%20]%20}) and confirm that WP loads without Asyncify errors and and memory leaks (check the browser console)
WP 6.4, PHP 8.0, networking enabled, no extra extensions. After installing the Woocommerce plugin, going through the Woo onboarding flow halts at one moment with a bunch of Asyncify errors. Let's identify where they come from and add the required functions to the ASYNCIFY_ALLOWLIST in the PHP build Dockerfile as well as the
php-asyncify.spec.ts
unit testsHere's a few ideas that would be good to test and Asyncify-allowlist regardless:
To get nice stacktraces in the web version of PHP, it needs to be rebuilt with
-O0 -g2
emcc flags here (hardcoding them for testing is fine):wordpress-playground/packages/php-wasm/compile/php/Dockerfile
Line 805 in c1e7433
The text was updated successfully, but these errors were encountered: