[OpenAFS-devel] Stack size too small

Jim Rees rees@umich.edu
Mon, 7 Jan 2008 12:45:30 -0500


I'm getting reports on OpenBSD of various servers, mostly volserver and
fileserver, running out of stack space.  The traceback always includes this:

#8  0x1c0529c4 in _rxkad_v5_decode_generalized_time ()
#9  0x1c056a39 in _rxkad_v5_decode_KerberosTime ()
#10 0x1c055d98 in _rxkad_v5_decode_EncTicketPart ()
#11 0x1c057a6a in tkt_DecodeTicket5 ()
#12 0x1c0508d6 in rxkad_CheckResponse ()

There is a minumum stack size for lwp, in lwp.h, but not for pthread, as far
as I can tell.  The fileserver starts to set its own stack size, but then
only really sets it for hpux, sun, and sgi:

    stackSize = lwps * 4000;
    if (stackSize < 32000)
	stackSize = 32000;
    else if (stackSize > 44000)
	stackSize = 44000;
#if    defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI51_ENV)
    rx_SetStackSize(1, stackSize);
#endif

Volserver does set its own stack size:

#ifdef AFS_SGI_ENV
    rx_SetStackSize(service, 49152);
#else
    rx_SetStackSize(service, 32768);
#endif

My guess is that I only want to increase the stack size in apps that call
into the k5 library, and then maybe only for threads that will make those
calls.  Otherwise I could impose a minimum for pthreads in lwp.c.  But this
being user space, and the 21st century, maybe just bumping the minimum up
for everything would be reasonable.  Suggestions?