Open fd opened 1 year ago
I did some investigating today. This bug is related to the lack of setjmp
/longjmp
support, obviously.
Ruby has a working version of the setjmp
api. It relies on asyncify. I believe this approach was already mentioned in a blog post but not yet implemented.
I integrated the ruby code with php v7.4.32 and it seems to work well. I'd like to open a PR with the patch but I'm unsure how to produce the actual patch file from the build-staging directory.
Hello @fd! Thank you for taking the time to investigate this issue. You are absolutely right, this issue is due to the fact of a missing setjmp/longjmp emulation.
We are super interested in looking at your patch and integrating it!
When you clone the repo locally, you can add your patch to https://github.com/vmware-labs/webassembly-language-runtimes/tree/main/php/php-7.4.32/patches, and then from the root of the repo you should be able to build PHP by running make php/php-7.4.32
.
You need docker or podman for this build to succeed. After it has been built, you can find the PHP artifact at php/build-output/php/php-7.4.32/bin
.
I integrated the ruby code with php v7.4.32 and it seems to work well. I'd like to open a PR with the patch but I'm unsure how to produce the actual patch file from the build-staging directory.
In case you did your changes in build-staging/php/php-7.4.32/checkout
, here is what you can do to ensure the patch format is the same as the other patches.
pushd build-staging/php/php-7.4.32/checkout && git commit -m "..." && popd
source scripts/wl-env.sh php/php-7.4.32
./scripts/wl-update-patches.sh
wl-env-unset
I'm looking forward to seeing what you did as we're working on enabling PHP 8 fibers via asyncify so this can be combined with your work to a better end.
I prepared the patch here https://github.com/vmware-labs/webassembly-language-runtimes/pull/28
When
exit;
is called and the headers have not yet been flushed the CGI response is completely empty. The issue seems to be that the shutdown procedures are not called onexit;
.Reproduction
When I run the scripts with a native php-cgi binary it produces the expected CGI responses.
But when I run the
test-exit-flush-fail.php
withwasmtime
it fails to produce a CGI response.