Apache Web Server fails to start while loading SiteMinder module mod_sm24/mod_sm22, and following error message appears in Windows event viewer.
Faulting application name: httpd.exe, version: 2.4.17.0, time stamp: 0x56187590
Faulting module name: mod_sm24.dll, version: 12.52.103.767, time stamp: 0x55f7cc05
Exception code: 0xc00000fd
Fault offset: 0x0000000000167987
Faulting process id: 0xab4
Faulting application start time: 0x01d1570bf07d34be
Faulting application path: C:\Apache24\bin\httpd.exe
Faulting module path: C:\Program Files\CA\webagent\win64\bin\mod_sm24.dll
Report Id: ######
Analyzing the crash dump with Microsoft Debug Diag shows following exception :
In httpd__PID__##__Date__12_02_2015__Time_11_29_21AM__813__Second_Chance_Exception_C00000FD.dmp the assembly instruction at mod_sm24!CSmPasswordMsgWriter::WriteMessage+6d4c7 in C:\Program Files\CA\webagent\win64\bin\mod_sm24.dll from Netegrity, Inc. has caused a stack overflow exception (0xC00000FD) when trying to write to memory location 0x00033000 on thread 0
Web Agent Version: r12.52 SP1 CR2 (However, this is applicable for any r12.5x version)
Web Server OS : Windows
Web Server : Apache 2.4/2.2
The default size for the reserved stack space (and initially committed stack memory) is specified in the executable file header (httpd.exe)
In Windows, the Apache webserver executable (httpd.exe) is built with a default stack reserve of 256KB.
This is not sufficient for SiteMinder module, hence while loading SiteMinder module, Apache encounters the stack overflow exception as it can't provide enough memory to reserve the number of bytes requested.
An external utility, EDITBIN.exe, can be used to modify the binary executable’s header and the required stack reserve memory can be specified.
Sample syntax:
EDITBIN.EXE /STACK:reserve <files>
So, for our current requirement, we can increase the stack reserve to default 512KB as below :
EDITBIN.EXE /STACK:524288 httpd.exe
This tool is bundled with Visual studio by default.
Additionally, both Visual studio and the attached editbin standalone zip comes with "link" tool which can be used to dump header information from the executable.
1. Step 1: Find stack information from the header dump
C:\Apache24\bin\editbin>link /dump /headers httpd.exe | find "stack"
40000 size of stack reserve
1000 size of stack commit
2. Step 2: Using editbin.exe increase stack reserve memory to 512KB
C:\Apache24\bin\editbin>editbin /stack:524288 httpd.exe
Microsoft (R) COFF/PE Editor Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
3. Step 3: Verify using the header dump if the stack reserver memory is increased or not
C:\Apache24\bin\editbin>link /dump /headers httpd.exe | find "stack"
80000 size of stack reserve
1000 size of stack commit
Note : 40000hex = 256KB, 80000hex = 512KB