[comp.sys.ibm.pc] STACK OVERFLOW, SYSTEM HALTED

joep@tnosoes.UUCP (Joep Mathijssen) (01/22/90)

Can somebody help me with this error:

    'STACK OVERFLOW, SYSTEM HALTED'.

I would like to know:

 - Is it related to a certain dos-version.
 - Can I write a program that ignores this problem.


===============================================================================
Joep Mathijssen
TNO Institute for Perception
P.O. Box 23          		Phone : +31 34 63 562 11
3769 ZG  Soesterberg    	E-mail: tnosoes!joep@mcvax.cwi.nl
The Netherlands         	    or: uunet!mcvax!tnosoes!joep
===============================================================================

risto@tuura.UUCP (Risto Lankinen) (01/24/90)

joep@tnosoes.UUCP (Joep Mathijssen) writes:

>Can somebody help me with this error:

>    'STACK OVERFLOW, SYSTEM HALTED'.

The MS-DOS -originated STACK OVERFLOWs are generated mainly by several
interrupts occurring simultaneously or in a short period of time in their
reverse priority order (or even a single interrupt, whose handler is
incorrectly designed so that it clears it "served"-flag before actually
being that).  The result is that the stack soon fills up of saved CPU
registers and return addresses...

Fortunately there is a CONFIG.SYS setting in MS-DOS versions (I think)
above 3.00 .  That is STACKS=<number-of-int-stacks>,<size-of-each> .

For example, in CONFIG.SYS, STACKS=8,512 creates 8 stacks for interrupt
service routines, each 512 bytes in size (and spends memory accordingly).
The STACKS=0,0 disables stack switching feature.  As far as I know, the
default is 9,128 , which should of course be exceeded in order to fix
the problem.

One more thing, the STACKS setting affects only those interrupts that
MSDOS.SYS or IO.SYS is responsible to care for.  I haven't seen specs
for how one can use this in one's own devdrvs; if such have been seen
I would like to know where to get that info.

terveisin: Risto Lankinen

-- 

rkl@cbnewsh.ATT.COM (kevin.laux) (01/25/90)

In article <672@tnosoes.UUCP>, joep@tnosoes.UUCP (Joep Mathijssen) writes:
> Can somebody help me with this error:
> 
>     'STACK OVERFLOW, SYSTEM HALTED'.

	DOS itself has been corrupted when this message appears.  The only
recourse is to reboot the system so that a fresh copy of DOS is loaded.

> I would like to know:
>  - Is it related to a certain dos-version.

	No.

>  - Can I write a program that ignores this problem.

	No.

--rkl

tcm@srhqla.SR.COM (Tim Meighan) (01/25/90)

In article <672@tnosoes.UUCP> joep@tnosoes.UUCP (Joep Mathijssen) writes:

>Can somebody help me with this error: 'STACK OVERFLOW, SYSTEM HALTED'.
> - Is it related to a certain dos-version.
> - Can I write a program that ignores this problem.

This is usually caused by a buggy program, or one that has not allocated 
enough stack space.  It means that some process running in the computer
keeps pushing (saving) information on the stack without ever pulling it
off again -- sometimes a sign of a subroutine accidently calling itself
over and over or some other infinite looping problem.  What happens is that
the stack finally fills up (it's only been allocated a certain amount
of memory) and it has no way of saving any more info.

Since you didn't mention the circumstances that cause the stack to overflow,
it's hard to guess what is wrong here.  However, it is not possible to
ignore a stack overflow on a PC.  Since the stack is usually used for very
important stuff -- like pointers to where a subroutine is supposed to return
to when it's done -- a stack overflow on a PC is catastrophic, and crashes
the computer -- hence the SYSTEM HALTED message.

If you can figure out exactly what circumstances cause this to happen, you
will be that much closer to correcting the problem.

Tim Meighan
Silent Radio

dlo@ubc-idacom (Dennis Lo) (02/04/90)

I get this error when I hit a lot of keys in a short time (eg. if I
press my hand on the keyboard) while running the fireworks program
EXPLOD 2.0.  The too-many-interupts explanation offered by one of the
previous postings would explain this.  However, this problem only 
happens on my machine (a '186 with a "LEO PC" BIOS) and only under
DOS 3.2.
 
This problem was discussed in this group a long time ago... I don't
remember very clearly, but I think the conclusion then was that it was
partly a problem with DOS 3.20, and that DOS 3.21 corrected this. I
don't have DOS 3.21 so I can't verify this.  Does anyone else remember?

---
Dennis Lo   dlo@idacom.cs.ubc.ca

leonard@bucket.UUCP (Leonard Erickson) (02/08/90)

pipkins@qmsseq.imagen.com (Jeff Pipkins) writes:

>In article <672@tnosoes.UUCP> joep@tnosoes.UUCP (Joep Mathijssen) writes:
>>Can somebody help me with this error:
>>
>>    'STACK OVERFLOW, SYSTEM HALTED'.
>>

>I know this is going to be a little hard for those of us who know better
>to believe, but here goes.

>I have seen this symptom caused by a hardware problem.  This doesn't
>necessarily mean that it's caused by hardware in your specific case, but
>be aware that it is possible.

[description of problem involving odd AT clone and odd 286 chups deleted]

>Anyone else hear of this sort of thing?

We have several IBM PCs that are rather old and well used. Like about
100 of them...

A few of them will generate a stack overflow if you do a print-screen
from inside a Turbo Pascal menu program we use. We swapped everything
but the motherboard, even the CPU. The "bad" motherboards get the
error, the others are just fine.

It isn't a BIOS bug as the good machines and bad machines have the same
BIOS version. 

By playing with various things, we could get other nasties to happen when
we hit the printscreen key. But we never tracked it down.
-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I'm all in favor of keeping dangerous weapons out of the hands of fools.
Let's start with typewriters." -- Solomon Short