linux stability problems

linux stability problems

Post by Massimo Fubin » Sat, 29 Mar 1997 04:00:00



I wrote a program to test the OS stablity and I have seen that linux is
not too stabile.
I would like someone to explain me why the system crushed.

The program is:

main()
{
int *i;
while (1)
{
i=(int*) malloc(100*sizeof(int));

Quote:}
}

The system finish memory and do not kill the stupid program I wrote and
then become unrecuperable.
 
 
 

linux stability problems

Post by Brian Wheel » Sat, 29 Mar 1997 04:00:00




Quote:>I wrote a program to test the OS stablity and I have seen that linux is
>not too stabile.

        No, you've written a program that shows that linux is unstable when
a program tries to allocate all available ram+swap (and a touch more) and
you've not set a ulimit to stop that from happening.  That doesn't show linux
to be unstable, it just shows it to be unstable in this case...which is a
case that virtually never happens unless someone is really trying to do this.

Quote:>I would like someone to explain me why the system crushed.

        You've used up all the memory in the system, and not checked for
errors, so your program tries to allocate more.  When the system can't allocate
any more, it crashes.

Quote:

>The program is:

>main()
>{
>int *i;
>while (1)
>{
>i=(int*) malloc(100*sizeof(int));
>}
>}
>The system finish memory and do not kill the stupid program I wrote and
>then become unrecuperable.

        If you're afraid a user will try to run a program of this nature (or
many processes, or open too many files, etc) you should investigate bash's
ulimit command.

--
Brian Wheeler


 
 
 

linux stability problems

Post by Eri » Sat, 29 Mar 1997 04:00:00




>>I would like someone to explain me why the system crushed.

>    You've used up all the memory in the system, and not checked for
>errors, so your program tries to allocate more.  When the system can't allocate
>any more, it crashes.
>>The program is:

>>main()
>>{
>>int *i;
>>while (1)
>>{
>>i=(int*) malloc(100*sizeof(int));
>>}
>>}
>>The system finish memory and do not kill the stupid program I wrote and
>>then become unrecuperable.

Actually, the system _shouldn't_ and _doesn't_ crash when you allocate all
memory and try to allocate more.  I seem to recall a program doing exactly
that as a means of detecting virtual memory. Even more so -- this program
doesn't actually write to any pages, so they are never 'committed' (IF my
understanding is correct -- I invite correction).  

My _GUESS_ as to why this happens is that the syscall to increase memory
area ( sbrk(2)? ) takes a finite amount of time even in cases where there
is no memory, and the switching mechanism doesn't take that kernel time
into account?  

The reason for this, is already running programs (ie, I was running 'top'
while running a program of this nature) freeze as well.  

I WONDER why Unix didn't extend the concept of 5% free for root to memory
as well.  On a 64 meg system, that'd be 3 megs.. which should be enough to
run a program to kill the offending programs.  

This still doesn't help against poorly written daemons (ie sshd), which
you can use to hammer your machine with repeated connections (see octopus.c).

So, while linux _can_ be a stable environment, you have to sacrifice a lot of
flexibility to make it work as such ).

 
 
 

linux stability problems

Post by Greg Walk » Mon, 31 Mar 1997 04:00:00


    Brian>   If you're afraid a user will try to run a
    Brian> program of this nature (or many processes, or open
    Brian> too many files, etc) you should investigate bash's
    Brian> ulimit command.

Out of curiosity I ran the program on my (crusty) 1.2.13
setup. It didn't crash the machine; but it did reach a point
where "ps" would segmentation-fault, and other utilities like
"ls" would die from memory exhaustion. Setting ulimits under
bash somehow didn't change matters (ulimit -Hm 100000; ulimit
-Hd 100000). Considering "ps" was failing, it would be hard for
a sysadmin to kill the errant process, except maybe by halting
the system.

gw

--
Greg Walker

 
 
 

linux stability problems

Post by Paul Flinder » Wed, 02 Apr 1997 04:00:00





> >>I would like someone to explain me why the system crushed.

> >       You've used up all the memory in the system, and not checked for
> >errors, so your program tries to allocate more.  When the system can't
> > allocate any more, it crashes.
> >>The program is:

 > >> [ resource hog source snipped]

Quote:> >>The system finish memory and do not kill the stupid program I wrote and
> >>then become unrecuperable.

> Actually, the system _shouldn't_ and _doesn't_ crash when you
> allocate all memory and try to allocate more.  I seem to recall a
> program doing exactly that as a means of detecting virtual
> memory. Even more so -- this program doesn't actually write to any
> pages, so they are never 'committed' (IF my understanding is correct
> -- I invite correction).

Almost - the blocks that he's allocating are only 400 bytes big.  This
is probably (I haven't checked) too large for the "small block"
allocation so writing the malloc control structures will cause the
memory to be paged in.

Quote:

> [...]

> I WONDER why Unix didn't extend the concept of 5% free for root to
> memory as well.  On a 64 meg system, that'd be 3 megs.. which should
> be enough to run a program to kill the offending programs.

Interesting and quite possibly a good idea. Question to all - has this
been suggested before?  How do you measure the 5% in the face of
overcommittal?

Quote:

> So, while linux _can_ be a stable environment, you have to sacrifice
> a lot of flexibility to make it work as such ).

I disagree.

A question to the original poster - in what way did your system
"crash" - I tried a slightly modified version of your program on my
system (P100, RH 4.0, 2.0.28 kernel 64Mb Ram + 256Mb swap, no process
limits set). Whilst I couldn't start any new processes almost
everything which was running continued (one shell died - it probably
tried to allocate some memory) and all I had to do was type ^C in the
shell from which I started your program.

Really - complaining about this sort of thing is a bit like moaning
about your car because if you continue to drive until you're out of
fuel you then have to walk home.

Regards

Paul.

 
 
 

linux stability problems

Post by Ralf Baech » Wed, 09 Apr 1997 04:00:00




|> >>I would like someone to explain me why the system crushed.
|> >
|> >      You've used up all the memory in the system, and not checked for
|> >errors, so your program tries to allocate more.  When the system can't allocate
|> >any more, it crashes.
|> >>The program is:
|> >>
|> >>main()
|> >>{
|> >>int *i;
|> >>while (1)
|> >>{
|> >>i=(int*) malloc(100*sizeof(int));
|> >>}
|> >>}
|> >>The system finish memory and do not kill the stupid program I wrote and
|> >>then become unrecuperable.
|>
|> Actually, the system _shouldn't_ and _doesn't_ crash when you allocate all
|> memory and try to allocate more.  I seem to recall a program doing exactly
|> that as a means of detecting virtual memory. Even more so -- this program
|> doesn't actually write to any pages, so they are never 'committed' (IF my
|> understanding is correct -- I invite correction).  
|>
|> My _GUESS_ as to why this happens is that the syscall to increase memory
|> area ( sbrk(2)? ) takes a finite amount of time even in cases where there
|> is no memory, and the switching mechanism doesn't take that kernel time
|> into account?  

In the above example the pages _are_ commited.  The allocated chunks are much
smaller than a page; malloc uses some bytes immediately before the returned
chunk to store data about the chunk.  This means that all pages allocated
via brk(2) / mmap(2) in above example are actually being commited.

|> The reason for this, is already running programs (ie, I was running 'top'
|> while running a program of this nature) freeze as well.  
|>
|> I WONDER why Unix didn't extend the concept of 5% free for root to memory
|> as well.  On a 64 meg system, that'd be 3 megs.. which should be enough to
|> run a program to kill the offending programs.  
|>
|> This still doesn't help against poorly written daemons (ie sshd), which
|> you can use to hammer your machine with repeated connections (see octopus.c).
|>
|> So, while linux _can_ be a stable environment, you have to sacrifice a lot of
|> flexibility to make it work as such ).

Try using resource limits.

  Ralf

--
74 a3 53 cc 0b 19

 
 
 

1. A real linux stability problem --- please read

Hello All,

I have a little problem.

We are a small private school that has moved from a pure M$ house to almost
pure linux. We run linux on the server and it does Samba (for the few
winnderrrs boxen), NAT, NIS, NFS, firewall, and fileserving. It is Redhat
7.3. It is as stable as any box I have ever seen.

In the lab, we have 20 boxen which are mostly K6 AMD boxes with a few Dells.
We have run SuSE and also RedHat. We have used GDM and KDM.

The problem is that the boxes will freeze at the login screen every once in
a while. The box goes unused for a while and the screen blanks --- and most
of the time moving the mouse or hitting a key brings back the screen. But,
every once in a while the box must be re-booted to regain controll.

Hell fire, this is heaven compared to last year with 18 win98 boxes (same
machines). But, I would like to fix this little irritation.

Oh, it seems only the K6 AMD home built boxes with freeze.

Any ideas?

--
Regards, Joe
GNU/Linux user # 225822

2. SUNOS 4.1.3 on a dual processor

3. linux stability problem

4. fsb4.5/majordomo

5. X Setup problem...

6. linux stability problems

7. Printers

8. Linux Stability Problems in High Load Environment

9. linux stability problems

10. Hardware stability (was: Linux stability???)

11. Stability problems Linux 2.0.18 with AMD K5 100

12. FreeBSD 4.4 stability shutdown problem