Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Stack allocation hosed in Digital Unix 3.2C ?
@ 1996-02-02  5:00 Toon Moene
  1996-02-05  5:00 ` Yes, was: " Toon Moene
  0 siblings, 1 reply; 2+ messages in thread
From: Toon Moene @ 1996-02-02  5:00 UTC (permalink / raw)


Hi All,

I hope that someone recognises the symptoms I'll describe in a moment and  
is able to point me to a solution.

I _was_ the happy user of an Alphaserver (don't know the exact model  
number - it has 2 190 Mhz Alpha 21064's, 192 Mb of memory and several  
gig's of disk space) and was running Digital Unix 3.2.

Then, on a black Tuesday, system management decided to upgrade to 3.2C and  
- lo and behold - several of my program binaries, which had been running  
unattented for weeks (one to three hours at a stretch), stopped working  
with a Segmentation fault.

The problem was easily reproduced by the following simple program:

      program bug
      real a(4000000)
      do i = 1, 4000000
         a(i) = 0.0
      enddo
      print*,(a(i), i=1,4000000,100000)
      end

when compiled with f77 -automatic, or the equivalent C program:

main()
{
	int i;
	float a[4000000];
	for (i=0; i<4000000; i++)
		a[i] = 0.0;
	printf("%f\n", a[1000000]);
}

(The print statements are only there to prevent all code to be optimised  
away - they're never reached).

The Fortran program can be made running by omitting the '-automatic'  
switch, the C program by adding 'static' to the declaration of the array.

And yes, the 'limit' command shows I am allowed to use up to 40 Mb of  
stack space.

Any takers ?

TIA.

[ Local DEC support couldn't come up with an answer too, yet ]

--
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
URL: http://www.knmi.nl/hirlam



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

* Yes, was: Stack allocation hosed in Digital Unix 3.2C ?
  1996-02-02  5:00 Stack allocation hosed in Digital Unix 3.2C ? Toon Moene
@ 1996-02-05  5:00 ` Toon Moene
  0 siblings, 0 replies; 2+ messages in thread
From: Toon Moene @ 1996-02-05  5:00 UTC (permalink / raw)


In article <1057@moene.indiv.nluug.nl> I wrote:

[ ... Segmentation fault on a program using 16 Mb of stack
      when 40 Mb is allowed - under Digital Unix 3.2C ... ]
> 
> [ Local DEC support couldn't come up with an answer too, yet ]
>

Well, today they did.  The answer is that Digital Unix 3.2C as shipped has  
the setting of the kernel variable 'stackinc' wrong.  It is shipped as 4  
pages (32 Kb) and should be 16 pages (128 Kb).  How exactly this leads to  
the problem described I don't know; nor do I know if in cases of even  
larger stack usage the quoted number of 16 pages is adequate.

As root, perform the following:

# kdbx -k /vmunix /dev/mem
p stackinc
32767
a stackinc=0x20000
131072
quit

Normally, the automatic growth of the stack is made possible by bounding  
it with 'guard' pages (in fact, page table entries that will lead to  
access violations giving the OS the chance to expand the stack area).   
Apparently, there's a mismatch between the amount of expansion the OS  
thinks it has performed and the real value.  This, however, is a guess - I  
haven't seen any kernel code of Digital Unix; perhaps someone from Digital  
in the know could clarify.

--
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
URL: http://www.knmi.nl/hirlam



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

end of thread, other threads:[~1996-02-05  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-02  5:00 Stack allocation hosed in Digital Unix 3.2C ? Toon Moene
1996-02-05  5:00 ` Yes, was: " Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox