ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 8 forks source link

PHP8.1 segfaults on linting #83

Open markvds opened 1 year ago

markvds commented 1 year ago

I don't know whether this happens on all platforms, but on my Fedora 37 host machine, PHP CLI segfaults when linting a file (part of our pre-commit hook) on the latest Hypernode Docker (PHP 8.1.12):

# php -v
PHP 8.1.12 (cli) (built: Oct 28 2022 17:32:24) (NTS)
[...]
# echo "<?php phpinfo();" | php -l
Segmentation fault (core dumped)

The problem arises only on PHP 8.1, only when linting (as far as I have seen) and only on the latest Hypernode Docker.

I hope this problem is over with a new PHP (patch) release, but it would also be nice to know if others experience the same problem.

tdgroot commented 1 year ago

Hi Mark,

Thanks for reporting the problem. We're going to look into this and let you know once it's fixed!

markvds commented 1 year ago

Update: I just noticed a new Hypernode Docker release. I assumed that updating PHP 8.1 would solve the problem, but unfortunately it din't.

# php -v
PHP 8.1.18 (cli) (built: Apr 14 2023 04:26:30) (NTS)
[...]
# echo "<?php phpinfo();" | php -l
Segmentation fault (core dumped)

The rest of the situation hasn't changed: any other available PHP version just works. And to be complete: this problem only arises in the Docker environment, not on live Hypernode environments and also my host machine (which also runs on 8.1.18) has no problems.

I'd be happy to help, but I don't really know where to start :(

markvds commented 1 year ago

Apparently, I did know where to start :-)

Disabling the opcache.so module in cli config (I just removed the symlink /etc/php/8.1/cli/conf.d/10-opcache.ini) seems to solve the issue.

This will probably have a minor effect on CLI performance, but I don't think anyone will even notice the difference on their development environment.

tdgroot commented 1 year ago

Hi @markvds! Great to hear you have found an intermediate solution :).

In the Docker images we have ionCube enabled by default and we've found that in this specific case it conflicts with opcache. We have disabled ionCube for the PHP 8.1 images, so now it should work out of the box!


$ docker run -it docker.hypernode.com/byteinternet/hypernode-buster-docker-php81-mysql80:latest bash -c 'echo "<?php phpinfo();" | php -l'
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
No syntax errors detected in Standard input code
markvds commented 1 year ago

Thanks for the update! It's something that has been on my to do list for a while now, to disable ionCube by default for our own implementation of the Docker image. We have no customers that use ionCube. A good motivation to finally do this! :-)

As a sidenote: We only have one image that switches php versions while booting. @tdgroot Have you disabled it in the php8.1 configuration of all images (in /etc/php8.1/*/conf.d/), or specifically in the php8.1 images?