I am using NGINX version 1.2.5. Under load serving requests, I encountered memory loss. I found three memory leaks which I fixed in my code. The leaks were in the response handling code where memory was not freed properly especially if NGX_AGAIN was encountered due to SSL back pressure.
However, it prompted this curious situation when the memory leak was happening. I typically reload NGINX on a regular basis to grab new configuration that I posted on an hourly basis. I have one master and four workers. When the memory leak was happening, and memory was depleted on my linux box, the reload would fail at the end of two days since there wasn't enough memory left to start a new worker and remove the old one. That I understand, but what confuses me, is why on every reload, since the old worker was removed, the memory leak wouldn't be masked since a process is removed and its memory should have been returned to Linux. When I perform an NGINX restart, that would return all leaked memory. The difference that I gather is that on a restart the master worker is also brought down. But isn't every worker running with its own memory scope?
Can someone explain to me how memory is handled differently in a reload versus a restart that can explain this behavior?
Thank you.
However, it prompted this curious situation when the memory leak was happening. I typically reload NGINX on a regular basis to grab new configuration that I posted on an hourly basis. I have one master and four workers. When the memory leak was happening, and memory was depleted on my linux box, the reload would fail at the end of two days since there wasn't enough memory left to start a new worker and remove the old one. That I understand, but what confuses me, is why on every reload, since the old worker was removed, the memory leak wouldn't be masked since a process is removed and its memory should have been returned to Linux. When I perform an NGINX restart, that would return all leaked memory. The difference that I gather is that on a restart the master worker is also brought down. But isn't every worker running with its own memory scope?
Can someone explain to me how memory is handled differently in a reload versus a restart that can explain this behavior?
Thank you.