php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69598 Memory leak when updating cache
Submitted: 2015-05-08 01:10 UTC Modified: 2020-03-19 09:47 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: naoki-kawamukai at cybozu dot co dot jp Assigned: cmb (profile)
Status: Closed Package: opcache
PHP Version: 5.5Git-2015-05-08 (Git) OS: Debian 7.8
Private report: No CVE-ID: None
 [2015-05-08 01:10 UTC] naoki-kawamukai at cybozu dot co dot jp
Description:
------------
I use php-fpm + opcache.
My configuration is following:
 opcache.enable=1
 opcache.revalidate_freq=2
 opcache.validate_timestamps=1
 opcache.log_verbosity_level=4

When accessing test script twice, memory leaks detected.
I think this bug occurs when updating cache.

This leaks occurs on PHP 5.5(Git-2015-05-08), PHP 5.6(Git-2015-05-08).
But it does not occur on PHP 7.0(Git-2015-05-08)

Test script:
---------------
<?php
touch(__FILE__);
sleep(3);

Expected result:
----------------
Memory does not leak.

vagrant@php7dev:/var/www/default$ sudo tailf /var/log/nginx/php-fpm_error.log
[08-May-2015 01:03:13] NOTICE: fpm is running, pid 25975
[08-May-2015 01:03:13] NOTICE: ready to handle connections
[08-May-2015 01:03:17] WARNING: [pool www] child 25978 said into stderr: "Fri May  8 01:03:17 2015 (25978): Message Cached script '/var/www/default/test/opcache_touch_self.php'"
[08-May-2015 01:03:22] WARNING: [pool www] child 25976 said into stderr: "Fri May  8 01:03:22 2015 (25976): Message Cached script '/var/www/default/test/opcache_touch_self.php'"

Actual result:
--------------
Memory leaks.

vagrant@php7dev:/var/www/default$ sudo tailf /var/log/nginx/php-fpm_error.log
[08-May-2015 01:03:13] NOTICE: fpm is running, pid 25975
[08-May-2015 01:03:13] NOTICE: ready to handle connections
[08-May-2015 01:03:17] WARNING: [pool www] child 25978 said into stderr: "Fri May  8 01:03:17 2015 (25978): Message Cached script '/var/www/default/test/opcache_touch_self.php'"
[08-May-2015 01:03:22] WARNING: [pool www] child 25976 said into stderr: "Fri May  8 01:03:22 2015 (25976): Message Cached script '/var/www/default/test/opcache_touch_self.php'"
[08-May-2015 01:03:25] WARNING: [pool www] child 25976 said into stderr: "[Fri May  8 01:03:25 2015]  Script:  '-'"
[08-May-2015 01:03:25] WARNING: [pool www] child 25976 said into stderr: "/home/vagrant/php-src/ext/opcache/ZendAccelerator.c(1931) :  Freeing 0x7F62A4877CF0 (45 bytes), script=-"
[08-May-2015 01:03:25] WARNING: [pool www] child 25976 said into stderr: "=== Total 1 memory leaks detected ==="


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-12 12:17 UTC] kenorb at gmail dot com
Related: #66442
 [2020-03-19 09:47 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-03-19 09:47 UTC] cmb@php.net
> But it does not occur on PHP 7.0(Git-2015-05-08)

So I'm assuming that it does neither occur with any of the
actively supported PHP versions[1].

[1] <https://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 01:03:40 2021 UTC