The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Memory Leak - How do you diagnose one?

Discussion in 'General Discussion' started by hostricity, Oct 16, 2004.

  1. hostricity

    hostricity Active Member

    Joined:
    Jun 22, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    I have a memory leak and am having no luck at finding it.

    Let me first tell you a sordid little story that will set this up.

    I am running a Virtuosso VE with whm / cpanel provided by a vendor in his operating center.

    I was on a VE where everything was running just fine.

    My vendor migrated me to a new box with the latest and greatest version of Virtuosso (I didn't ask for the migration, but that is a different story.)

    As far as I know, everything was fine at that point (although, it is possible that I didn't notice the problem at that point)

    I went into root whm and there was an Apache Security notice. So, I recompiled to fix the security leak. The recompile did not work correctly and my vendor had to fix it.

    Since then, I now have a memory leak that runs out the private memory (privvmpages) after a few hours.

    Now:

    I think that it is a either a problem with the new Virtuosso or it is a problem caused by the recompile for the security leak. It could be a problem between my code and the new environment.

    My vendor says that it is a problem with my code. The only stuff on this server are some applications intalled by Fantastico, some html stuff, and a couple of php scripts I wrote using an XML RPC library.

    My vendor tells me that the memory leak is my problem - which I think is far from clear.

    But, I cannot demonstrate the truth or falsity of this claim because I have been unable to determine the source of the memory leak.

    (I am a highly experienced and competent programmer, but, not in this environment)

    My vendor tells me there are no tools for diagnosing this.

    So, what I'd like is a suggestion of an approach to diagnosing this problem.

    Are there no utilities that can track memory allocations (by, time and script, or something) so that I can see what is going on.

    I've looked at top, but, I don't see anything that makes any sense to me.

    Does anyone have any suggestions of an approach to this problem?

    Thanks in advance for any suggestions.

    Geoff
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Hi Geoff,

    You might want to look for a more helpful host ;) My initial reaction would be a problem either with Virtuozzo or their stup of it, as memory leaks are quite unlikely.

    Having said that, they are possible. Here are a few things I would start off with:

    1. Enable WHM > Shell Fork Bomb Protection . This will stop user processes and CGI scripts from consuming excessive server resources.

    2. When you run top, hit the M key to sort by memory usage. To get more information out of top, you can also do the following:

    c
    s
    2[enter]
    W


    Note, there's only one hit of the enter key in the above. The c turns on the commands being issues for each process. The s 2 [enter] tells top to scan every 2 seconds and the W writes those settings to disk.

    If nothing seems apparent, you can get detailed memory information on current processes using:

    ps axfvwww

    You could also install the sysstat rpm (if you're running a flavour of RedHat, which you probably are) and thgen use the sa utility to look for high memory usage. Not played with it myself, but it provides process resource usage information.

    However, if the memory leak is with the VPS itself, none of this will show anything. Feel free to PM me if you'd like me to take a peek.
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    One more thing, just incase it is apache related, you should also run WHM > Modify Apache Memory Usage which will set a cap on the amount of memory and CPU that apache can use.
     
Loading...

Share This Page