ustimenko (ustimenko) wrote,
ustimenko
ustimenko

How to win memleaks in mod_aspdotnet @ apache2 on win32?

Cause


Read wiki on "memleaks" and it will say:
1) Change the program
2) Restart the program

1 isn`t our case, so we choose 2nd.

Solution


There is a solution — put to Task Scheduler this JS-script every 15 minutes:


var shell = new ActiveXObject('WScript.Shell');
var tasks = shell.Exec('tasklist /FI "IMAGENAME eq Apache.exe" /FI "MEMUSAGE gt 300000"');
if (!tasks.StdOut.AtEndOfStream) {
var message = "" + tasks.StdOut.ReadAll();
if (message.indexOf('Apache') > 0) {
shell.Exec('/Apache2/bin/Apache -k restart');
}
}


Concretics


Our concrete values are:

  • 15 minutes

  • 300000 KB ~ 300 MB of memory

  • restart command /Apache2/bin/Apache -k restart




Prospectives and common soultion



var args = WScript.Arguments;
var fileName = args(0);
var memoryLimit = args(1);
var restartAction = args(2);
var shell = new ActiveXObject('WScript.Shell');
var tasks = shell.Exec('tasklist /FI "IMAGENAME eq ' + fileName + '" /FI "MEMUSAGE gt ' + memoryLimit + '"');
if (!tasks.StdOut.AtEndOfStream) {
var message = "" + tasks.StdOut.ReadAll();
if (message.indexOf(fileName) > 0) {
shell.Exec(restartAction);
}
}
Tags: apache, Победа
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments