php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72391 Committed memory steadily increasing
Submitted: 2016-06-12 16:43 UTC Modified: 2016-07-25 21:22 UTC
Votes:5
Avg. Score:4.2 ± 1.0
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: rob dot vandermei at gmail dot com Assigned:
Status: Closed Package: FPM related
PHP Version: 7.0.7 OS: CentOS 6.8
Private report: No CVE-ID: None
 [2016-06-12 16:43 UTC] rob dot vandermei at gmail dot com
Description:
------------
Since upgrading to PHP 7.0.7, committed memory keeps increasing until I restart FPM, and then it begins all over again. 

I found one other person ("canique") reporting something similar after upgrading to 7.0.6: https://www.dotdeb.org/2016/04/29/php-7-0-6-for-jessie/

"Since upgrading to php 7.0.6 I see memory issues. The committed memory in linux is increasing all the time. I’m checking this with “cat /proc/meminfo | grep Committed_AS”
To see this bug, it’s important to not restart php-fpm and to have a high max request count in your php process pool (pm.max_requests). Each time the php child process is quitting, this memory is of course released. But if those child processes get multiple thousands of requests the committed memory is steadily increasing."

PHP 7.0.7 (cli) (built: May 25 2016 17:35:28) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

[PHP Modules]
apc
apcu
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
sockets
SPL
sqlite3
standard
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

Installed Packages
php70-php-cli.x86_64                                                          7.0.7-1.el6.remi                                                                 @remi
php70-php-common.x86_64                                                       7.0.7-1.el6.remi                                                                 @remi
php70-php-fpm.x86_64                                                          7.0.7-1.el6.remi                                                                 @remi
php70-php-gd.x86_64                                                           7.0.7-1.el6.remi                                                                 @remi
php70-php-json.x86_64                                                         7.0.7-1.el6.remi                                                                 @remi
php70-php-mcrypt.x86_64                                                       7.0.7-1.el6.remi                                                                 @remi
php70-php-mysqlnd.x86_64                                                      7.0.7-1.el6.remi                                                                 @remi
php70-php-opcache.x86_64                                                      7.0.7-1.el6.remi                                                                 @remi
php70-php-pdo.x86_64                                                          7.0.7-1.el6.remi                                                                 @remi
php70-php-pecl-apcu.x86_64                                                    5.1.5-1.el6.remi                                                                 @remi
php70-php-pecl-apcu-bc.x86_64                                                 1.0.3-1.el6.remi                                                                 @remi
php70-runtime.x86_64                                                          1.0-5.el6.remi                                                                 @remi


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-03 16:32 UTC] maroszek at gmx dot net
I can verify the issue. 

7.0.5 is working fine
7.0.6+ is leaking lots of memory

The php script can be empty. (I just added php opening tags <?)

I am using PHP as an embed library. Therefore i cannot restart the process and my application dies quite quickly.
 [2016-07-05 07:49 UTC] maroszek at gmx dot net
I was able to pinpoint the problem to this commit:
https://github.com/php/php-src/commit/e23a41225fc4ea099b88e7fc450459173443d98f

After this commit my virtual memory usage skyrockets :)

I am using this simple piece of code: https://gist.github.com/paresy/b4babb919a86e9764bc4

Visual Studio 2015, Update 2 on Windows 10 x64
I will attach a screenshot of the diag window in a minute
 [2016-07-05 07:52 UTC] maroszek at gmx dot net
Screenshot:
https://dl.dropboxusercontent.com/u/8356310/memory1.png
 [2016-07-05 11:27 UTC] laruence@php.net
could be dup to #72476, could you please try the snapshot of php-7.0 branch?

it may already be fixed by this commit: https://github.com/php/php-src/commit/bd74e7d0133493ee4290857ac368f5fbdd278084

thanks
 [2016-07-06 08:12 UTC] maroszek at gmx dot net
Indeed. This fixes the issue. 

I had to make a change in php.h (Line 259) though. There seems to be an error in the current master.

From:
# if PHP_WIN32

To:
# if defined(PHP_WIN32)

Otherwise MSVC was very unhappy.

Thanks for the fix!
 [2016-07-25 21:22 UTC] rob dot vandermei at gmail dot com
-Status: Open +Status: Closed
 [2016-07-25 21:22 UTC] rob dot vandermei at gmail dot com
Fixed after upgrading to 7.0.9. Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 02:01:26 2024 UTC