I got a problem with Apache and PHP7 on Debian... It is automatically configured by apt... my scripts are making a lot of calculating with a lot of memory used (limit - 512MB). But I noticed that every time I run the script with different parameters, /usr/sbin/apache2 -k start
is using more and more memory... it seems that it's not being freed properly. Any ideas how to fix it? Or how to get to what exactly causes it?
The problem is serious and ends up in mmap() failed: [12] Cannot allocate memory
in Apache and PHP Fatal error: Out of memory
in PHP. With 100% of overall memory used (that is never freed) and inability to do anything more.
It doesn't seem to kill new spawned processes after connection...
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
12123 www-data 20 0 369M 117M 7272 S 0.0 *6.0* 0:18.40 /usr/sbin/apache2 -k start
12132 www-data 20 0 357M 105M 7272 S 0.0 *5.4* 0:17.96 /usr/sbin/apache2 -k start
12122 www-data 20 0 333M 84296 7860 S 0.0 *4.2* 0:18.35 /usr/sbin/apache2 -k start
12133 www-data 20 0 311M 61160 7272 S 0.0 *3.1* 0:08.00 /usr/sbin/apache2 -k start
12131 www-data 20 0 293M 42732 7272 S 0.0 *2.1* 0:17.70 /usr/sbin/apache2 -k start
12134 www-data 20 0 291M 40676 7272 S 0.0 *2.0* 0:08.32 /usr/sbin/apache2 -k start
12124 www-data 20 0 275M 25040 7900 S 0.0 *1.2* 0:16.19 /usr/sbin/apache2 -k start
12125 www-data 20 0 265M 13084 6768 S 0.0 *0.7* 0:00.01 /usr/sbin/apache2 -k start
12128 www-data 20 0 265M 13060 6708 S 0.0 *0.7* 0:00.01 /usr/sbin/apache2 -k start
12126 www-data 20 0 265M 9468 3332 S 0.0 *0.5* 0:00.00 /usr/sbin/apache2 -k start
The value between *
is MEM%
from htop
. Every new calculation new process spawns. And others are using more and more memory...
apache2 -l
Compiled in modules:
core.c
mod_so.c
mod_watchdog.c
http_core.c
mod_log_config.c
mod_logio.c
mod_version.c
mod_unixd.c
a2query -M
prefork