linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
[parent not found: <no.id>]
* 2.4.8 Resource leaks + limits
@ 2001-08-15  5:11 Magnus Naeslund(f)
  2001-08-15  5:32 ` Linus Torvalds
  0 siblings, 1 reply; 37+ messages in thread
From: Magnus Naeslund(f) @ 2001-08-15  5:11 UTC (permalink / raw)
  To: linux-kernel

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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2001-08-18 22:33 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.33L.0108171818040.2277-100000@duckman.distro.conectiva>
2001-08-18 14:53 ` 2.4.8 Resource leaks + limits 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
     [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
2001-08-15  5:11 Magnus Naeslund(f)
2001-08-15  5:32 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).