All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Magnus Naeslund\(f\)" <mag@fbab.net>
To: "linux-kernel" <linux-kernel@vger.kernel.org>
Subject: 2.4.8 Resource leaks + limits
Date: Wed, 15 Aug 2001 07:11:18 +0200	[thread overview]
Message-ID: <3ce801c12548$b7971750$020a0a0a@totalmef> (raw)

Can anyone please explain something to me?
I saw Alan's comments on Ivan Kalvatchev's malloc "bomb".
So i thought maybe i should test to impose some limits, and try some changes
with Ivan's code.

Box:

Linux UltraSparc 2.4.8 #3 Tue Aug 14 01:03:31 CEST 2001 sparc64 unknown
(a Sun Ultra10)

Code:

--------8<-------8<-------8<-------8<-------8<-----------
struct entry { struct entry *next; char *p;} * head=0;

int main() {
   int i;
   struct entry *e;
   for(i=0;;i+=2*4) {
      if (!(e=malloc(4096)) || !(e->p = malloc(4096)))
        break;
      e->next = head;
      head = e;
      if (!(i%1024)) printf("malloc @ %dkb\n",i);
   }

   printf("Stopped at %dkb \nTouching-in-a-loop.\n",i);

   for (e=head ;; e=e->next?e->next:head )
     memset(e->p,++i % 256,4096);

   return 0;
}
--------8<-------8<-------8<-------8<-------8<-----------

Memory is (after run + swapoff + swapon):

[root@UltraSparc src]# free -m
             total       used       free     shared    buffers     cached
Mem:           122         38         83          0          1         17
-/+ buffers/cache:         20        101
Swap:         1057          0       1057

And the limits are:

*               -       rss             64000
*               -       memlock         32000
*               -       as              128000
*               -       data            64000
*               hard    nproc           50
*               soft    nproc           40
*               -       stack           666
*               soft    priority        16
*               hard    priority        12


I ran maybe 20-30 instances at once.
All process allocated the 64MB that it was allowed by the "data" limit.
The system went down to really crawling (but never locked up completly).
After a while the oom killer kicked in as well, when i ran out of swap+ram.

Question: why isn't there a limit for global memory usage per user?
No way could i stop these processes without decreasing the nproc stuff.
That's not really what one want's some time, you know :)

The more "real" issue here is that after this run i couldn't log on as
another user than root.
Even now (after swapoff -a and so) i can't log on as another user:

[root@UltraSparc src]# su -l mag2
can not fork user shell: Resource temporarily unavailable

How can i get my fargin resources back? :)

Nice that the system survived (kinda, took 15 min to get logged on via ssh
;) ), but it's not cool if i have to reboot anyways because my resources are
farged.

Can i do anything, or what?

Magnus

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
 PGP Key: http://www.genline.nu/mag_pgp.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2001-08-15  5:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-15  5:11 Magnus Naeslund(f) [this message]
2001-08-15  5:32 ` 2.4.8 Resource leaks + limits Linus Torvalds
2001-08-15  5:42   ` Ulrich Drepper
2001-08-15  8:31     ` Nadav Har'El
2001-08-15  5:43   ` dmaynor
2001-08-15  5:56     ` J Sloan
2001-08-15  6:59       ` Brian
2001-08-15  7:26         ` J Sloan
2001-08-15 13:51       ` Admin Mailing Lists
2001-08-15 14:12         ` dmaynor
2001-08-15 16:04         ` Alan Cox
2001-08-17 22:01           ` Rik van Riel
2001-08-17 22:08             ` Alan Cox
2001-08-17 23:25               ` Rik van Riel
2001-08-15  6:05   ` Magnus Naeslund(f)
2001-08-15  6:28     ` Alexander Viro
2001-08-15  7:24       ` Magnus Naeslund(f)
2001-08-15 14:21       ` Szabolcs Szakacsits
2001-08-15 14:20         ` Magnus Naeslund(f)
2001-08-16 19:41           ` Szabolcs Szakacsits
2001-08-16 19:54             ` Szabolcs Szakacsits
2001-08-17 15:56             ` Magnus Naeslund(f)
2001-08-15 15:00         ` Tobias Ringstrom
     [not found] <no.id>
2001-08-15 11:40 ` Alan Cox
2001-08-15 16:53   ` Linus Torvalds
2001-08-15 18:51     ` Alan Cox
2001-08-15 19:57     ` Ingo Oeser
2001-08-15 20:15       ` Alan Cox
2001-08-15 21:30         ` Jesse Pollard
2001-08-15 20:57       ` Anton Altaparmakov
2001-08-16  1:12       ` Jesse Pollard
2001-08-15 22:14     ` Horst von Brand
     [not found] <Pine.LNX.4.33L.0108171818040.2277-100000@duckman.distro.conectiva>
2001-08-18 14:53 ` Magnus Naeslund(f)
2001-08-18 15:24 ` Szabolcs Szakacsits
2001-08-18 15:20   ` Rik van Riel
2001-08-18 22:34     ` Alan Cox
2001-08-18 22:35     ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='3ce801c12548$b7971750$020a0a0a@totalmef' \
    --to=mag@fbab.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.