nginx php-fpm child exited with code 0

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

Solution 1:

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.

Solution 2:

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.