9

Anyone had a similar problem with php-fpm 7 with 11.0-RELEASE-p8 or know how to debug it?

Situation starts after few minutes and show only half pages to clients. Any pages show up about ~62kb of content with ending ��������� 4.

Log file of php-fpm:

[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80582 exited with code 0 after 0.005648 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80584 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80583 exited with code 0 after 0.005877 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80585 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80581 exited with code 0 after 0.007763 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80586 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80585 exited with code 0 after 0.005653 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80587 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80586 exited with code 0 after 0.005820 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80588 started

PHP config:

$php -v
PHP 7.0.17 (cli) (built: Mar 17 2017 02:07:44) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies

PHP-FPM.conf

pm = dynamic
pm.max_children = 25
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 3
pm.max_requests = 0 ;changing to 500
busy
  • 271
  • 1
  • 2
  • 7

2 Answers2

11

First, this is the expected behavior. The messages are marked as NOTICE, the default in php-fpm.conf:

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

Processes are exiting and respawning when pm.max_requests option is defined in your php-fpm configuration file.

For example:

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500

If it is defined as 500 in this example, php-fpm recycles the process after it has processed 500 requests. Actually, you can ignore these messages because they are harmless and just informational.

If you don't want those messages to be logged, just change your log level to something above notice, like warning.

Paulo Coghi
  • 588
  • 1
  • 11
  • 22
  • 1
    Thanks for the reply about logs. The problem here is that all pages output is blank until you restart the server, it does not matter if php-fpm respawn. The same behaviour on PHP 7.1 and 7.2 - I do not even think to enable exec function on php7.3 - but did not test it. – busy Mar 12 '19 at 22:37
6

it is php-fpm bug when using exec functions inside a code. good practice is to block them so the won't make such problem.

https://bugs.php.net/bug.php?id=73342

bug is open for last 4 years.

busy
  • 271
  • 1
  • 2
  • 7
  • Is this likely to be the only cause of the error OP has mentioned? If so, would changing up to PHP7.1 be a probable solution? I also have a server where that error is occurring constantly. Multiple time per second. I found this post on serverfault whilst looking for info on its cause. – inspirednz Mar 09 '18 at 07:41
  • @inspirednz this bug also affects PHP 7.1. It occurs when running a script which uses `stdin`, be it PHP or the sub-process launched in `shell_exec` or `exec`. – Yvan May 27 '18 at 05:02