Skip to content
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

Weird systemctl status phpX.Y-fpm output on Ubuntu 22.04 #10204

Open
datadestroyd opened this issue Jan 2, 2023 · 9 comments
Open

Weird systemctl status phpX.Y-fpm output on Ubuntu 22.04 #10204

datadestroyd opened this issue Jan 2, 2023 · 9 comments

Comments

@datadestroyd
Copy link

Description

On Ubuntu 22.04, systemctl status phpX.Y-fpm.service shows the following weird output:

     CGroup: /system.slice/php8.1-fpm.service
             ├─ 3132 "php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
             └─30747 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

I am not really sure what this is, but I don't think it's supposed to print all these quotation marks. It didn't happen on earlier LTS versions of Ubuntu. Maybe it is related to the systemd version that ships with Ubuntu 22.04 (which is 249.11). The same thing happens with packages from Ondřej Surýs PPA.

Steps to reproduce:

  • Install Ubuntu 22.04
  • sudo apt install php8.1-fpm
  • systemctl status php8.1-fpm.service

PHP Version

8.* and 7.4

Operating System

Ubuntu 22.04

@devnexen
Copy link
Member

devnexen commented Jan 2, 2023

can reproduce on 22.04 indeed not on 22.10.

@bukka
Copy link
Member

bukka commented Jan 12, 2023

I just had a look to https://packages.ubuntu.com/jammy/amd64/php8.1-fpm and the php-fpm.service in it looks like

[Unit]
Description=The PHP @PHP_VERSION@ FastCGI Process Manager
Documentation=man:php-fpm@PHP_VERSION@(8)
After=network.target

[Service]
Type=notify
ExecStart=/usr/sbin/php-fpm@PHP_VERSION@ --nodaemonize --fpm-config /etc/php/@PHP_VERSION@/fpm/php-fpm.conf
ExecStartPost=-/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/@PHP_VERSION@/fpm/pool.d/www.conf @PHP_MAJOR@@PHP_MINOR@
ExecStopPost=-/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/@PHP_VERSION@/fpm/pool.d/www.conf @PHP_MAJOR@@PHP_MINOR@
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

So this is completely custom unit file in no way related to what we supply as sort of template in https://github.com/php/php-src/blob/master/sapi/fpm/php-fpm.service.in .

So this should be really reported to https://github.com/oerdnj/deb.sury.org as there's nothing we can do about this upstream.

@bukka bukka closed this as completed Jan 12, 2023
@datadestroyd
Copy link
Author

@bukka I fail to see what the unit file has to do with it. Especially since the files are exactly the same on the other Ubuntu releases where the issue does not occur. It seems to me that there might be something wrong with how the process titles are reported to systemd. But that's just a guess.

In any event, I downloaded the PHP source (master branch), compiled it myself, and started a service using the unit file generated by the build process. The result: the quotation marks also occur.

@bukka
Copy link
Member

bukka commented Jan 18, 2023

Ok I was just thinking that it might be related to the unit file somehow as the issue dissappeared in 22.10 but it might be more likely something related to systemd (maybe some bug that got fixed later) and potentially the process title. Anyway it needs some investigation so re-opening.

@bukka bukka reopened this Jan 18, 2023
@CxDevLead
Copy link

Is this issue simply cosmetic?

The quotations caused quite a bit of head scratching when we updated to 22.04.

@datadestroyd
Copy link
Author

I found that it also happens with redis-server on Ubuntu 22.04. So it might not be PHP's fault, but a systemd issue. No idea if it's purely cosmetic or if there is something more to it. I still think someone should have a look at this. As far as I can tell, the issue is provoked somewhere in fpm_env.c where the process title is set by somehow fiddling around with argv. In a comment they mention that the code is inspired by "nginx and pureftpd". So redis-server probably uses some similar technique to change the process title.

@datadestroyd
Copy link
Author

After some further investigation I am now relatively convinced that this is a cosmetic issue. If you inspect /proc/$pid/cmdline (setting $pid to a PHP FPM process) the length of the file is much larger than the actual string, but the remainder is just a bunch of zero-bytes (0x00). I guess the length just stays the same as it was before the process title modification / argv fiddling. The same happens on, for instance, Ubuntu 18.04, only systemctl status does not display the zero-bytes as double double quotes, so you don't see it.

> xxd /proc/$pid/cmdline
00000000: 7068 702d 6670 6d3a 2070 6f6f 6c20 7777  php-fpm: pool ww
00000010: 7700 0000 0000 0000 0000 0000 0000 0000  w...............
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000       ..............

I wonder what happens if the process title is longer than the original argv string, tho... 🤔

@bukka
Copy link
Member

bukka commented Mar 28, 2024

I think there were potentially some changes in kernel cmdline implementation that got later changed back. It seems to me like that happened a bit earlier though but something likely changed back - one of the related commits is maybe torvalds/linux@3d71254 but I haven't looked too deeply into this. In any case it seems that the issue is no longer present in the later versions. I think that 22.04 got also updated so it would be great if someone could verify if it's still present? If so, could you please provide your kernel version?

I tested on Fedora 39 (kernel-6.7.11) as well as Ubuntu 20.04 (kernel 5.15.0) and not able to recreate it.

As noted this won't be PHP specific and don't think it's worth of my time to look into it more if it's temporary kernel thing.

@mitarulv
Copy link

mitarulv commented Apr 4, 2024

image

Still present 7.4.
Got this after updating server OS from 20.04 to 22.04 without removing previous php-fpm installation aka packages were marked as manual:

apt-mark manual php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-xml php7.4-xmlrpc php7.4-zip 

Gonna try removing them and install clean version and check if does the trick.

P.S. Reinstalling didn't solve it still seeing quotes in php7.4-fpm status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants