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:\{home_apache}\bin\httpd.exe
Faulting module path: C:\{home_web_agent}\win64\bin\mod_sm24.dll
Analyzing the crash dump with Microsoft Debug Diag shows following exception :
In httpd__PID__Second_Chance_Exception.dmp the assembly instruction at mod_sm24!CSmPasswordMsgWriter::WriteMessage+6d4c7 in C:\{home_web_agent}\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 12.52SP1CR2 on Apache 2.4 on Windows;
(However, this is applicable for any r12.5x version)
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 Web Server 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.
A Microsoft MSVC utility, EDITBIN.exe, can be used to modify the binary executable’s header, and the required stack reserve memory can be specified (1).
How to run it:
c:\> EDITBIN.EXE /STACK:reserve <files>
So, for the current requirement, increase the stack reserve to default 512KB as below:
c:\> EDITBIN.EXE /STACK:524288 httpd.exe
This tool is bundled with Visual studio by default.
Additionally, both Visual Studio comes with "link" tool which can be used to dump header information from the executable (2).
C:\{home_msvc}\> link /dump /headers C:\{home_apache}\bin\httpd.exe | find "stack"
C:\{home_msvc}\> editbin /stack:524288 httpd.exe
C:\{home_msvc}\> link /dump /headers httpd.exe | find "stack"
Note : 40000hex = 256KB, and 80000hex = 512KB