apt-get install lighttpd php7.0-cgi sudo lighttpd-enable-mod fastcgi fastcgi-php
Repro php leaking ~50MB each time at /var/www/html/index.php <?php header("Content-Type: text/plain"); ini_set('max_execution_time', 3); for ($i = 0; $i<100; $i++){ $a[$i] = array_fill(0, 16384, '1234567890-foobar'); } echo "Leaking " . memory_get_usage() . "\n"; #busy wait until killed, and consume execution time (so no sleep) $st_tm = time(); $diff=0; while (1){ if ((time() - $st_tm) > $diff) { $diff=(time() - $st_tm); echo "Waiting to Die " . date('h:i:s') . "\n"; flush(); } } ?> Track consumption and trigger it 5 times: $ apt install smem $ smem | grep www $ for i in $(seq 1 5); do wget http://127.0.0.1/index.php; done $ smem | grep www Pre: 19338 www-data /usr/bin/php-cgi 0 44 969 5164 19339 www-data /usr/bin/php-cgi 0 44 969 5164 19340 www-data /usr/bin/php-cgi 0 44 969 5164 19341 www-data /usr/bin/php-cgi 0 44 969 5164 19336 www-data /usr/sbin/lighttpd -f /etc/ 0 1244 1309 2400 19337 www-data /usr/bin/php-cgi 0 16548 17772 23392 Post: 19336 www-data /usr/sbin/lighttpd -f /etc/ 0 1544 1601 2764 19337 www-data /usr/bin/php-cgi 0 15564 17113 23216 19339 www-data /usr/bin/php-cgi 0 40432 41522 47184 19340 www-data /usr/bin/php-cgi 0 40432 41522 47184 19341 www-data /usr/bin/php-cgi 0 40432 41522 47184 19338 www-data /usr/bin/php-cgi 0 40456 41886 47872 Ok, that is a rise, still the same processes. Lets speed that up a bit - modify wget loop to be async: for i in $(seq 1 100); do (wget http://127.0.0.1/index.php &); done And run a few of them Post: 19336 www-data /usr/sbin/lighttpd -f /etc/ 0 1908 1965 3128 19337 www-data /usr/bin/php-cgi 0 13204 14371 19800 19339 www-data /usr/bin/php-cgi 0 53884 54746 59540 19340 www-data /usr/bin/php-cgi 0 53900 54813 59752 19338 www-data /usr/bin/php-cgi 0 53900 54985 60268 19341 www-data /usr/bin/php-cgi 0 53888 55006 60324 No matter what I do it doesn't rise over ~60MB per worker thread. I'd assume that is some smart caching/heap-reuse in place. The same is True for Ubuntu 16.04 and 17.04 so no new fix or such - just always as that. Is your case exceeding the system to crash at some point? How many cgi-bin processes do you have and what memory do they consume? ** Changed in: php7.0 (Ubuntu) Status: New => Incomplete -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1677578 Title: php-fcgi: max_execution_time causes memory leaks To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1677578/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs