[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: when debian run out of memory



On Fri, Aug 08, 2008 at 11:18:20AM +0800, hhding.gnu wrote:
> Hi list,
>
> When debian run out of memory, I can only ping the host and can't ssh to  
> the host.
> It seems oom-killer is running but memory is still exhaust.
>
> What should I do then? Only reboot can solve the problem?
> Can I protect oom-killer from kill the sshd then I can ssh to the box to  
> kill the process?

I don't have a lot of experience with this, but, the couple of times
I've hit this, everything runs... *REALLY* slowly. So much time is
taken up by the swapping that it takes *forever* for anything to
happen. Even a simple login can take several minutes. So first, be
patient.

Second, you *can* control how this all behaves. It appears, in my
reading, that the default configuration causes malloc() to
*always* succeed and then the oomkiller comes out to play
eventually. You can configure this through sysctl. see here:

http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommit.html

for info on it. There is a better article out there, but I can't find
it atm. 

The idea is to set vm.overcommit to 2 so that malloc() will fail when
you run out of memory. This causes the app trying to malloc() to get a
fail on malloc() and consequently handle it (gracefully or not). But
it keeps the oomkiller from coming out. 

another trick is to us ulimit -v <some amount of memory> to control
how much memory a process has access to. man bash and look for ulimit.

hope this helps and hopefully someone else with more knowledge  will
come along correct me...

A

Attachment: signature.asc
Description: Digital signature


Reply to: