Bug #80024 [Com]: Duplication of info about inherited socket after pool removing

From: Date: Tue, 29 Dec 2020 03:10:37 +0000
Subject: Bug #80024 [Com]: Duplication of info about inherited socket after pool removing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231294@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80024&edit=1

 ID:                 80024
 Comment by:         syazov at plesk dot com
 Reported by:        syazov at plesk dot com
 Summary:            Duplication of info about inherited socket after
                     pool removing
 Status:             Assigned
 Type:               Bug
 Package:            FPM related
 Operating System:   All Unix
 PHP Version:        7.4.9
 Assigned To:        bukka
 Block user comment: N
 Private report:     N

 New Comment:

Done, PR#6550 was created and linked.


Previous Comments:
------------------------------------------------------------------------
[2020-12-29 03:08:12] syazov at plesk dot com

The following pull request has been associated:

Patch Name: Fix bug #80024: prevent duplication of inherited sockets on reload
On GitHub:  https://github.com/php/php-src/pull/6550
Patch:      https://github.com/php/php-src/pull/6550.patch

------------------------------------------------------------------------
[2020-12-28 21:42:19] bukka@php.net

Ah good catch. The patch makes sense. Just detail that it doesn't contain your email (it's
more a diff) so do you want to use this email address as a commiter? Or if you could create a github
PR, that would be even better.

------------------------------------------------------------------------
[2020-08-27 04:32:20] syazov at plesk dot com

The following patch has been added/updated:

Patch Name: fix-inherited-socket-duplication-on-reload.patch
Revision:   1598502740
URL:        https://bugs.php.net/patch-display.php?bug=80024&patch=fix-inherited-socket-duplication-on-reload.patch&revision=1598502740

------------------------------------------------------------------------
[2020-08-27 04:30:22] syazov at plesk dot com

Description:
------------
"FPM_SOCKETS_X" env variable isn't cleaned when it's become unused.
The issue is appeared if count of sockets is changed from "FPM_ENV_SOCKET_SET_SIZE * n +
1" to "FPM_ENV_SOCKET_SET_SIZE * n"
In such cases the same socket presents in "FPM_SOCKETS_[socket_set_count - 1]" and
"FPM_SOCKETS_[socket_set_count]"
       

Test script:
---------------
#!/bin/bash -xe

# all paths are specific to default ones in Ubuntu 20.04
pool_d="/etc/php/7.4/fpm/pool.d"
pool_0="$pool_d/www.conf"
sed -i "s/^pm = dynamic$/pm = ondemand/" "$pool_0"
for i in {1001..1128}; do
    pool_i="$pool_d/www_$i.conf"
    cp -p "$pool_0" "$pool_i"
    sed -i "s/^\[www\]$/\[www_$i\]/" "$pool_i"
    sed -i "s|^listen = /run/php/php7.4-fpm.sock$|listen = /run/php/php7.4-fpm.$i.sock|"
"$pool_i"
done
systemctl restart php7.4-fpm

rm -f "$pool_d/www_1001.conf"
systemctl reload php7.4-fpm
systemctl reload php7.4-fpm

Expected result:
----------------
php-fpm reloads successfully.

Actual result:
--------------
"503 Service Unavailable" is shown

```
ls: cannot access '/run/php/php7.4-fpm.1128.sock': No such file or directory
```

```
[27-Aug-2020 10:31:00] NOTICE: reloading: execvp("/usr/sbin/php-fpm7.4",
{"/usr/sbin/php-fpm7.4", "--nodaemonize", "--fpm-config",
"/etc/php/7.4/fpm/php-fpm.conf"})
[27-Aug-2020 10:31:02] NOTICE: using inherited socket fd=7, "/run/php/php7.4-fpm.sock"
[27-Aug-2020 10:31:02] NOTICE: using inherited socket fd=135,
"/run/php/php7.4-fpm.1128.sock"
[27-Aug-2020 10:31:02] NOTICE: using inherited socket fd=9,
"/run/php/php7.4-fpm.1002.sock"
...
[27-Aug-2020 10:31:02] NOTICE: using inherited socket fd=134,
"/run/php/php7.4-fpm.1127.sock"
[27-Aug-2020 10:31:02] NOTICE: using inherited socket fd=135,
"/run/php/php7.4-fpm.1128.sock"
[27-Aug-2020 10:31:02] ERROR: epoll: unable to add fd 135
```


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80024&edit=1


Thread (10 messages)

« previous php.bugs (#231294) next »