I am facing random 502 errors (aprox. 50% of requests) with no apparent reason (CPU load is low, free memory is 60%+).
During investigation, I faced errors in PHP 7.4 FPM.
After starting php7.4-fpm service and checking service php7.4-fpm status
in sequence, I see:
root@server:~# service php7.4-fpm status
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-06-29 00:13:47 -03; 1s ago
Docs: man:php-fpm7.4(8)
Process: 12269 ExecStopPost=/usr/bin/update-alternatives --quiet --remove php-fpm.sock /run/php/php7.4-fpm.sock (code=exited, status=0/SUCCESS)
Process: 12297 ExecStartPost=/usr/bin/update-alternatives --quiet --install /run/php/php-fpm.sock php-fpm.sock /run/php/php7.4-fpm.sock 74 (code=exited, status=2)
Main PID: 12270 (php-fpm7.4)
Status: "Ready to handle connections"
Tasks: 2 (limit: 4915)
CGroup: /system.slice/php7.4-fpm.service
├─12270 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
└─12304 php-fpm: pool www-php74
Jun 29 00:13:46 server.example.com systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Jun 29 00:13:47 server.example.com update-alternatives[12297]: update-alternatives: error: alternative path /run/php/php7.4-fpm.sock doesn't exist
Jun 29 00:13:47 server.example.com systemd[1]: Started The PHP 7.4 FastCGI Process Manager.
I do not see these errors in other servers and I suspect this is related to the 502 errors.
Any tips on how to resolve this - and what could be the source of 502 errors, if not this?
Thanks in advance.