I noticed that php processes do not free memory after killing scripts that are running more than allowed by max_execution_time directive.
My setup is lighttpd with php configured as fcgi. Sample script (requires php-imagick) that can easily hit default 30 seconds time limit and uses a lot of memory so leaks are easy to notice:
<?php
define('__BASE__', 'images');
$photos = [];
if ($album_root = opendir(__BASE__)) {
while (false !== ($entry = readdir($album_root))) {
if (preg_match('/\.(jpe?g|gif|png)$/i', $entry)) { $photos[] = $entry;
}
} closedir($album_root); sort($photos); foreach($photos as $photo) {
$thumb = 'thumbs/'.$photo;
if (!file_exists($thumb)) { $image = new \Imagick(realpath(__BASE__.'/'.$photo)); $image->thumbnailImage(64, 48, true, false); $image->writeImage($thumb); $image->clear; $image = null;
}
}
}
?>
Just put many big JPGs to images directory.
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: php7.0-cgi 7.0.15-0ubuntu0.16.04.4
ProcVersionSignature: Ubuntu 4.8.0-45.48~16.04.1-generic 4.8.17
Uname: Linux 4.8.0-45-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.5
Architecture: amd64
Date: Thu Mar 30 14:37:16 2017
InstallationDate: Installed on 2011-04-14 (2177 days ago)
InstallationMedia: Ubuntu-Server 10.04.2 LTS "Lucid Lynx" - Release amd64 (20110211.1)
SourcePackage: php7.0
UpgradeStatus: Upgraded to xenial on 2016-07-30 (242 days ago)
I noticed that php processes do not free memory after killing scripts that are running more than allowed by max_execution_time directive.
My setup is lighttpd with php configured as fcgi. Sample script (requires php-imagick) that can easily hit default 30 seconds time limit and uses a lot of memory so leaks are easy to notice:
<?php '__BASE_ _', 'images'); $album_ root))) { '/\.(jpe? g|gif|png) $/i', $entry)) {
$photos[ ] = $entry;
closedir( $album_ root);
sort($ photos) ;
foreach( $photos as $photo) { exists( $thumb) ) {
$image = new \Imagick( realpath( __BASE_ _.'/'.$ photo)) ;
$image- >thumbnailImage (64, 48, true, false);
$image- >writeImage( $thumb) ;
$image- >clear;
$image = null;
define(
$photos = [];
if ($album_root = opendir(__BASE__)) {
while (false !== ($entry = readdir(
if (preg_match(
}
}
$thumb = 'thumbs/'.$photo;
if (!file_
}
}
}
?>
Just put many big JPGs to images directory.
ProblemType: Bug 0ubuntu0. 16.04.4 ature: Ubuntu 4.8.0-45. 48~16.04. 1-generic 4.8.17
DistroRelease: Ubuntu 16.04
Package: php7.0-cgi 7.0.15-
ProcVersionSign
Uname: Linux 4.8.0-45-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.5
Architecture: amd64
Date: Thu Mar 30 14:37:16 2017
InstallationDate: Installed on 2011-04-14 (2177 days ago)
InstallationMedia: Ubuntu-Server 10.04.2 LTS "Lucid Lynx" - Release amd64 (20110211.1)
SourcePackage: php7.0
UpgradeStatus: Upgraded to xenial on 2016-07-30 (242 days ago)