C Setting CGIDScriptTimeout When Using mod_cgid

Oracle HTTP Server includes mod_cgi and mod_cgid modules provided by Apache to run the CGI scripts.

When using a multi-threaded MPM on Unix, the mod_cgid module should be loaded instead of the mod_cgi module for better performance and to avoid unnecessary burden on the operating system due to forked multiple threads. The mod_cgid module has optimizations to improve the system performance in a multi-threaded environment as compared to the mod_cgi module. See Apache Module mod_cgid.

By default, the mod_cgid module is loaded when using a multi-threaded MPM on Unix. To verify the configuration:

  1. Open the httpd.conf file using the Advanced Server Configuration page in the Fusion Middleware Control or a text editor.
  2. In the LoadModule section, if mod_cgid is not configured already, add the following lines to load the mod_cgid module:
    
    <IfDefine OHS_MPM_EVENT>
        LoadModule cgid_module "${PRODUCT_HOME}/modules/mod_cgid.so"
    </IfDefine>
    
    <IfDefine OHS_MPM_WORKER>
        LoadModule cgid_module "${PRODUCT_HOME}/modules/mod_cgid.so"
    </IfDefine>
    

The mod_cgid module supports the CGIDScriptTimeout directive that can be used to limit the length of time to wait for more output from the CGI program.

CGIDScriptTimeout Directive

This directive limits the length of time to wait for more output from the CGI program.

If the time exceeds, the request and the CGI get terminated. It can be used to limit resource exhaustion due to the CGI scripts that stop communicating with the server and can protect against both unintentional errors and malicious actions (for example, DoS attacks).

By default, mod_cgid uses the Timeout Directive to limit the length of time to wait for CGI output. This timeout can be overridden with the CGIDScriptTimeout directive. The default value of CGIDScriptTimeout is the Timeout directive, when it is not set or set to 0. To configure CGIDScriptTimeout:

  1. Open the httpd.conf file using the Advanced Server Configuration page in the Fusion Middleware Control or a text editor.
  2. Add the following lines for configuring the CGIDScriptTimeout directive:
    <IfModule cgid_module> 
    # 
    # CGIDScriptTimeout: Limits the waiting time for output from the CGI program 
    # Replace 20 with the actual timeout value to be set in seconds 
    # 
     CGIDScriptTimeout 20
    </IfModule>
    

Note:

Testing should be performed with your application to ensure the best results. The timeout value should be set based on the time required by your CGI program to send output back to OHS. The above configuration instructs OHS to wait for 20 seconds for output from the CGI program.