-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Server crashes (134) in worker mode under certain conditions #803
Comments
Interesting! Thank you for providing a minimal reproducer, that helps a ton. I happen to be working on a php-src RFC for someone right now so I popped over to the pcntl extension to just take a quick gander. From the looks of it, it probably isn't compatible with FrankenPHP.
I'd have to actually debug it to figure out what is going on, but in theory this bug would happen on any ZTS build with this extension and multiple threads. |
Thanks for looking into it @withinboredom |
Actually Laravel Octane only needs pcntl for the CLI SAPI... to start FrankenPHP. FrankenPHP itself doesn't need nor use pcntl. It should be possible to install pcntl for CLI but not for FrankenPHP, and this should work for Octane. |
Symfony Messenger may also require pcntl. In any case, without this extension I can’t run a project that uses message processing in batches (not sure if this is related) https://symfony.com/doc/current/messenger.html#process-messages-by-batches I'm using RabbitMQ, the following packages are installed: I also had strange crashes with a large number of messages. It's very sad if this is related
|
@lermontex it's the same situation for Symfony Messenger. pcntl is only needed to run the consumer command (CLI), FrankenPHP (with the notable exception of the You could run the commands with the standard PHP CLI SAPI, (the That being said, this is just a workaround. The real solution is to fix the thread safety issue in pcntl. |
Could you please report this bug to PHP directly, as this doesn't look specific to FrankenPHP (and there is nothing we can do about that in this code base). |
@dunglas, The fact is that, as far as I understand, using dunglas/symfony-docker I will have to add an additional image for Messenger I'm currently using one image to run the webserver and handler. A similar solution is described here I think it should be mentioned that this may cause errors since the
Anyway, it seems we need to add information about incompatibility (if this is indeed the case) to the documentation |
@lermontex we can document it in the "known issues" page! PR welcome. Thanks to the reproducer, this bug shouldn't be too hard to fix. I have a very busy week (and the next will be busy too), but I'll try to take a look after that if someone didn't had time to work on this. |
@dunglas, Unfortunately, I will not be able to provide more specific information, since I was never able to find out why the errors occurred in my case. I just mentioned that incompatibility with pcntl can also affect the operation of Symfony Messenger. Hope this can prevent unexpected errors and improve comppatiblity in the future Anyway, thanks for your work! |
You can do this by using different |
I've noticed that triggering The main problem with these types of crashes is how hard they are to reproduce |
Thanks for the reproducer. I can reproduce the bug on Mac using the latest version. I'm on it. |
#857 fixes the problem on my side. I don't think that it's related to pcntl. Could you try this patch to see if it fixes the issue for you too @AlliBalliBaba? |
I suspect it will fix the issue. I'll try installing from source if I have time or with a new release once it's out |
I can confirm that v1.2.1 does indeed fix the bug. |
What happened?
I am seeing weird server crashes in the
dunglas/frankenphp:1.1-php8.3-bookworm
anddunglas/frankenphp:1.1-php8.3-alpine
images if thepcntl
extension is also installed.The Frankenphp worker server will crash when uploading a multipart/form-data image and then redirecting afterwards. The issue seems to stem from some memory misallocation. The bug seems to happen consistently when the worker only handles 1 request. For reproducing this minimal example, you have to create a
frankenphp-worker.php
with the following content:To get the server crash, I had to do the following:
(dunglas/frankenphp:1.1-php8.3-bookworm)
install-php-extensions pcntl
)It is also weird that this is not 100% consistent.
I recorded this bug in Ubuntu (WSL) (amd) in both the
dunglas/frankenphp:1.1-php8.3-bookworm
anddunglas/frankenphp:1.1-php8.3-alpine
docker images. But -only- if thepcntl
extension is also installed so maybe there's an incompatiblity there? It feels very randomAlso when the bug occurs (inconsistently) I see either
free(): invalid pointer
in the output before the POST request is handled ordouble free or corruption (out)
after the request is handled.Build Type
Docker (Debian Bookworm)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output
The text was updated successfully, but these errors were encountered: