Tuxedo 8.1: Fix Large Memory Size Increase For Multithreaded Servers in Tuxedo 8.1 (Doc ID 776203.1)

Last updated on NOVEMBER 04, 2016

Applies to:

Oracle Tuxedo
Information in this document applies to any platform.
Information in this document applies to any platform

Goal

 
DESCRIPTION:
The memory size of the customer's multithreaded servers running on HP-UX 32-bit has increased from 5MB in Tuxedo 7.1 to 15MB in Tuxedo 8.1.
This is causing a problem with the customer's planned upgrade to Tuxedo 8.1, since the upgrade would cause them to exceed the amount of memory available on their machines.

CONFIGURATION:
HP-UX 32-bit
Tuxedo 8.1

ANALYSIS:
Tuxedo makes use of the operating system default stack size when creating threads, unless the application has specified that an alternate value be used.

On some operating systems, the OS default is known to be insufficient, and we use a size of 1,024,000 bytes as the default thread stack size,
which is specified as TUX_DFLT_THR_STACK in some of the platform-specific versions of <tmmach.h> under gp/libgp/mach.

In the original Tuxedo 7.1 multithreading release, this default of 1,024,000 bytes was used on Compaq Tru64 Unix, UnixWare, and Sequent machines.

When we added 64-bit HP support in a Tuxedo 8.0 rolling patch, we found that the HP default thread stack size of 64K was insufficient for 64-bit HP,
and we used the 1,024,000 byte value for 64-bit HP as well.

In Tuxedo 8.1, the size of many bulletin board parameters was increased from 78 bytes to 256 bytes, requiring greater memory usage on start-up.
The HP default stack size was no longer sufficient, and the 1,024,000 byte default is used for both 32-bit and 64-bit HP.

The 1,024,000 byte default for platforms with an insufficient OS default was chosen arbitrarily as a value that should be big enough for almost all applications.

When stack memory is allocated, it is initially uninitialized, and many operating systems do not reserve physical memory space to hold uninitialized pages
until such time as a memory location in that page is first referenced or set. (This is the case on Solaris.)
Therefore, we were not concerned with making the default thread stack size as small as possible.
(We also did not want to make the thread stack size arbitrarily big, however, since this could cause a machine with a 32-bit address space to run out of memory address space if many threads were in use.)

However, on HP, physical memory is allocated for all of the thread stack whether this memory is referenced or not.

The size of 1,024,000 bytes per process is causing a problem for this customer.

It is currently not possible to decrease the thread stack size used by Tuxedo below 1,024,000 bytes on the platforms where the OS default value is not used due to code in gp/thread/posix/gpthread.c
which forbids decreasing the stack size below TUX_DFLT_THR_STACK when TUX_DFLT_THR_STACK is defined.

We held a conference call with the customer on January 7 and we agreed to provide a Tuxedo 8.1 patch that allows customers to specify a value for the existing UBBCONFIG THREADSTACKSIZE parameter
or the existing TA_THREADSTACKSIZE MIB parameter and have this lower value be honored on all platforms, rather than being ignored as it is today on the 4 platforms where TUX_DFLT_THR_STACK is defined.

We will still enforce some level of lower limit on THREADSTACKSIZE to prevent stack overflow core dumps in applications with typical stack memory usage.

We do not want to change the default value of THREADSTACKSIZE, since some customers may depend on the current behavior.

The memory used is only a problem for customers with many multithreaded servers, and is only a problem on certain platforms.

We want the new minimum stack size enforced on platforms where the OS default is insufficient to be somewhat greater than the actual amount required,
so that customers can use at least several thousand bytes of stack space per thread in their applications without experiencing stack overflow.
(If the thread stack size limit is exceeded, the application will dump core, and the core dump will not give any clue as to the cause,
resulting in a bad situation for the customer and for Tuxedo support.)

CURRENT STACK USAGE REQUIREMENTS:

In Tuxedo 7.1 RP328 running on one of internal box, threadapp succeeds with THREADSTACKSIZE=50000 and dumps core with THREADSTACKSIZE=49000.
(No code modification other than UBBCONFIG modicication is necessary to test this value, since HP uses the OS default stacksize in 7.1.)
Minimum stack requirements may vary based on the customer application and the OS used.

In Tuxedo 8.1 RP157 with a modified version of gp/thread/posix running on one of internal box, threadapp succeeds with THREADSTACKSIZE=78000 and dumps core with THREADSTACKSIZE=77000.
Minimum stack requirements may vary based on the customer application and the OS used.


Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms