Bug #69885 [Opn->Dup]: (unexpecteadly) Increasing wasted memory when file are removed
Edit report at https://bugs.php.net/bug.php?id=69885&edit=1
ID: 69885
Updated by: cmb@php.net
Reported by: maxence at typhon dot com
Summary: (unexpecteadly) Increasing wasted memory when file
are removed
-Status: Open
+Status: Duplicate
Type: Bug
Package: opcache
Operating System: Debian 7
PHP Version: 5.6.10
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #68631.
Previous Comments:
------------------------------------------------------------------------
[2015-06-19 15:13:33] maxence at typhon dot com
Description:
------------
PHP 5.6.10 from tarbal, compiled with :
./configure --disable-all --prefix=/usr/local/php-5.6.10 --enable-fpm --enable-ctype
--enable-mbstring --enable-gd-native-ttf --enable-zip --with-mcrypt --with-openssl --with-gd
--with-jpeg-dir=/usr/lib --with-freetype-dir --with-curl --with-pcre-regex --with-gettext
--enable-pdo --with-pdo-mysql=mysqlnd --with-iconv --enable-fileinfo --enable-filter --enable-json
--enable-session --enable-hash --enable-libxml --enable-dom --enable-libxml --enable-simplexml
--enable-bcmath --enable-soap --enable-opcache --enable-ftp --enable-intl
opcache config is :
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 1 => 1
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 16 => 16
opcache.load_comments => 1 => 1
opcache.log_verbosity_level => 4 => 4
opcache.max_accelerated_files => 30000 => 30000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 1024 => 1024
opcache.optimization_level => 0xFFFFFFFF => 0xFFFFFFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
We used to remove a lot of php files from time to time (~ 70Mb) when releasing, without any manual
opcache flush or php restart. Every time we remove the files, the same amount of space is added to
wasted_memory. Looks like opcache does not reclaim the memory when the file is removed (and then
recreated) but only put it as "wasted". Also, the memory wasted is far bigger than the
configured 5%, and opcache doesn't restart.
I achieved to reproduce this in a simple test (see below). Note that the sleep time matters. With
"sleep 3", the wasted memory increase after every cycle. With "sleep 2", it only
increases every ~ 2 times, which let me think the issue has something to do with the revalidate
process (and revalidate_freq).
Test script:
---------------
# for i in $(seq 1 100);do rm -f /var/www/web-default/a.php && echo '<?
echo("hi"); ?>' > /var/www/web-default/a.php; sleep 3; curl -s http://127.0.0.1/a.php >/dev/null; curl -s http://127.0.0.1/opcache_stat.php |grep
wasted_memory;done
Expected result:
----------------
wasted memory should not increase, so something like :
"wasted_memory": 72192,
"wasted_memory": 72192,
"wasted_memory": 72192,
"wasted_memory": 72192,
Actual result:
--------------
wasted memory increase for the same size every time.
"wasted_memory": 72192,
"wasted_memory": 72960,
"wasted_memory": 73728,
"wasted_memory": 74496,
"wasted_memory": 75264
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69885&edit=1
Thread (2 messages)