Bug #80117 [Com]: Apache and PHP leaking memory and also does not releasing it

From: Date: Fri, 18 Sep 2020 13:08:28 +0000
Subject: Bug #80117 [Com]: Apache and PHP leaking memory and also does not releasing it
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229071@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80117&edit=1 ID: 80117 Comment by: gilperon at gmail dot com Reported by: gilperon at gmail dot com Summary: Apache and PHP leaking memory and also does not releasing it Status: Not a bug Type: Bug Package: *General Issues Operating System: WINDOWS 10 AND CENTOS 8 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: No I am getting this error in my apache: VirtualAlloc() failed: [0x000005af] The paging file is too small for this operation to complete. Clearly memory is not being cleaned with the 2 functions I told you. So yeah, now Apache is crashing. Previous Comments: ------------------------------------------------------------------------ [2020-09-17 23:20:32] gilperon at gmail dot com First of all, it's not a matter if apache will crash or not. It's about gc_mem_caches() and gc_collect_cycles() not working as they should. Because in some circunstances those 2 functions look to work fine (as the explode example I gave you in another bug report - on that thread the function gc_mem_caches() worked perfectly, completely reseting memory usage to initial values when apache was restarted). HOWEVER now, with the new code I provided you, those 2 functions are not working as expected. So I think the main issue here is not wheter apache will crash or not, but WHY those 2 functions are not doing what they are supposed to? With the code I provided you on this thread I am sure gc_collect_cycles() should not help anything, BUT gc_mem_caches() should help clearing the entire cache. ------------------------------------------------------------------------ [2020-09-17 18:19:41] danack@php.net > So, if you have a VPS with 2GB of RAM (which is already PRETTY LOW) and you run my sample code, > you will probably crash your Apache with less than 15 requests. "probably" Or maybe, the Apache memory manager will kick in and free the memory. As I said, if you are seeing it crash that would be one thing. But you're saying: > HOWEVER, if I execute that same exactly script over, and over, and over... in less than 15 > requests I will end up consuming my entire VPS RAM memory (2GB) with TRASH/CACHE. Which reads to me as if you think it will crash....but it probably won't. ------------------------------------------------------------------------ [2020-09-17 18:07:48] gilperon at gmail dot com My friend, I will copy the phrase where I told you my Apache is crashing on RAM: "If I keep executing that same code again, and again, and again... Apache RAM usage increases every single time the script finishes its execution by about 180MB." So, if you have a VPS with 2GB of RAM (which is already PRETTY LOW) and you run my sample code, you will probably crash your Apache with less than 15 requests. I also have to clear one thing you said "are you having a problem with a script using all the memory". NO! I am not having problems with my script using all my RAM. No! My script runs fine, it starts fine, finishes fine with lots of RAM to spare. HOWEVER, if I execute that same exactly script over, and over, and over... in less than 15 requests I will end up consuming my entire VPS RAM memory (2GB) with TRASH/CACHE. I am not complaning about my script using lots of memory, NO! I am complaining about PHP leaving lots of trash behind AFTER executing my code, so this trash adds up in a short time and crashes apache. ------------------------------------------------------------------------ [2020-09-17 17:29:30] danack@php.net > danack@php.net did you read everyhing I told you? Yes. > and error_log file will say that apache is "Out of > memory". I'm being blind. I can't see anything about a log file. Where is this in your bug report? Okay, this is a wild guess; are you having a problem with a script using all the memory, and are trying to make a reproduce case? ------------------------------------------------------------------------ [2020-09-17 17:23:03] gilperon at gmail dot com danack@php.net did you read everyhing I told you? As you execute that same script a few dozen times, it will end up consuming all system RAM memory and error_log file will say that apache is "Out of memory". You said "Until you actually see some result that causes an actual problem". So, isnt this a problem? Apache is yelling at me, saying I have no more memory after my server receives only a few requests (not at the same time, the requests are mostly one after another). If you think this is not a problem, I have no idea what you consider being a problem. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=80117 -- Edit this bug report at https://bugs.php.net/bug.php?id=80117&edit=1

« previous php.bugs (#229071) next »