My VPS account continues to be from time to time drained of memory. It's using Apache on Linux. Support states it is a slow memory leak and it has enabled MaxRequestsPerChild to cope with it.
I've got a couple of questions regarding this. Whenever a child process dies, does it cause my scripts to get rid of session data? Does anybody have suggestions about the way i can find this memory leak?
No, whenever a child process dies you won't lose data unless of course it had been in the center of a request at that time (that ought to not occur whether it exits because of MaxRequestsPerChild).
Gradually alter reproduce the memory leak utilizing an identical software stack in your test system. You should use tools for example Valgrind to try and identify it.
You may also consider using a debug build of the web server and it is modules, which will allow you to identify what's happening.
It's tough to breed the behavior of production systems in non-production ones. For those who have auto-test coverage of the web application, you could attempt making use of your full auto-test suite, but used this really is unlikely to pay for every code path therefore may miss the leaking one.
Whenever a child process dies, does it cause my scripts to get rid of session data?
Not understanding what scripting language and session handler you're using (and also the actual code) it rather difficult to say.
Generally, using scripting languages in modules or via [fast] cgi, then it's most unlikely the session data would really be lost - although when the process dies in the center of processing a request it might not have a chance to create the up-to-date session to whatever is storing the session. As well as in the unlikely event it dies throughout the writeback, it might corrupt the session data. They are quite exceptional conditions.
OTOH in case your application logic is implemented using a daemon (e.g. a Java container) then it's quite probable that memory leaks could accumulate (although these could be reported against another process).
Observe that if the issue is alleviated by setting MaxRequestsPerChild it suggests that the issue is occurring within an Apache module.
The development releases of Apache itself, in my opinion, is extremely stable without memory leaks. However I have not used all of the modules. Unsure if ExtendedStatus provides a breakdwon of memory usage by module - may be worth checking.
I have formerly seen issues with the memory control over modules loaded through the PHP module not improving PHP's memory limits - these did obvious lower in the finish from the request though.