We have 2 large yii2 application, which ran perfectly in a Debian Docker container with nginx + PHP-FPM 7.3 and opcache enabled.
After upgrading to PHP 7.4.10, some requests result in ‘(Connection reset by peer) while reading response header from upstream’ errors. Disabling opcache solves the problem, but this is not really an option. I can also leave opcache enabled and blacklist the whole yii2 vendor folder, but this is also not an option.
We have also a non-docker PHP-FPM 7.4 + nginx + opcache installation on a Debian VM, this seam to so far without such errors. But we need the Docker environment for development and later switching to docker in production.
Running the tests with PHP 7.3 + opcache took about 12 minutes, now without opcache 30 minutes(!).
I tried and was not successful:
using the official Yii2 docker image using the official PHP 7.4.10 apache image using the official PHP-FPM 7.4.10 with latest Nginx image Using lower versions of docker than 'Docker version 19.03.12-ce, build 48a66213fe' setting several parameters in different variants in nginx, opcache and php, I found in the net like ignoring invalid headers for nginx. Downgrading the PHP version to 7.4.9 or 7.4.2. Trying to find and fix the error causing code in our code base, but in the most cases just the resulting content just changed, mean the same controller action runs with and without an error, while only the content has changed. Headers and HTTP return code were the same.
I also observed in some cases a core dump is triggered due to segmentation fault.
We have the problem on all of our developer machines, like Mac notebooks, Windows notebooks and Linux notebooks using Ubuntu or Fedora.
OS: 5.7.19-2-MANJARO Docker: 19.03.12-ce, build 48a66213fe CPU: Intel i7-1065G7 RAM: 16 GB SSD: 512 GB PCIe NVMe M.2
If anyone has some suggestions and even know how to solve the issue.
I configured my local system to run php-fpm 7.4.10 and configured the nginx in the docker container to use my local (on host) php-fpm.
I got no errors or “Connection reset by peer” events.
So for me it seams to be a problem with docker and opcache.
Does anyone know what yii2 is doing when opcache is enabled and maybe how configure it?