|
Memory leaks from just using 'require'
|
|
|
Author |
Message |
rafaldob
Joined: 29 Jul 2019 Posts: 2
|
Posted: Mon Jul 29, 2019 1:41 pm Post subject: Memory leaks from just using 'require' |
|
|
I've been investigating memory leaks that occur on our production server and can be also reproduced locally. As it turns out without ionCube the memory usage is constant and with ionCube it's constantly growing.
We're using php-fpm with nginx and the results of `php --version` are as follows:
Code: | PHP 7.2.20 (cli) (built: Jul 12 2019 23:48:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.7, Copyright (c) 2002-2019, by ionCube Ltd.
with Zend OPcache v7.2.20, Copyright (c) 1999-2018, by Zend Technologies |
The problem can be reproduced with a couple simple scripts:
index2.php:
Code: | <?php
for ($i = 0; $i < 100; $i++) {
require '/var/www/app/public/index3.php';
}
die('ok'); |
index3.php:
Code: | <?php
// Nothing here. It only exists to be included |
And then I use this simple script to make requests (I replaced the URL to where index2.php is hosted with URL_HERE, because otherwise I get a blank screen when trying to post this topic)
Code: | <?php
while (TRUE) {
exec(
"curl -s -X GET URL_HERE",
$output
);
echo date('H:i:s') . PHP_EOL;
} |
I run 8 parallel instances of this script and memory usage of php-fpm increases by about 0.2% per minute per worker.
The `require` in a loop is just an example to reproduce the problem in the simplest way possible. The real life situation is that we have Laravel framework application and memory is leaking just from including dependencies from the vendor directory. |
|
Back to top |
|
 |
rafaldob
Joined: 29 Jul 2019 Posts: 2
|
Posted: Mon Jul 29, 2019 1:58 pm Post subject: |
|
|
Also just tried PHP 7.3.7, didn't help. |
|
Back to top |
|
 |
alastair
Joined: 23 Feb 2010 Posts: 405
|
Posted: Mon Jul 29, 2019 2:29 pm Post subject: |
|
|
Hi,
It is best to report such issues in our Support Help Desk at https://support.ioncube.com Please create a ticket there about this issue. In your ticket please clarify which files in your example are encoded and, also, what encoding options you have used.
We did make an update in Loader versions 10.3.5 and 10.3.6 that tackled memory leaks when repeatedly including encoded files. However, we were aware that leakage still existed in some cases. In particular, less memory may be freed in the case where an unencoded file includes an encoded file than would be ideal. _________________ Alastair
ionCube |
|
Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|