Forum

Time Out !!

Shashank
21 May 2009, 18:23
Hi
I am trying to access a C program which gives me some values on the basis of which i generate a XML.
this XML is used at the client side, combined with the XSL to show the webpage.
I am using a cgi written in c++ to access this C program.

Now the problem is this c program takes some time to execute (less then a minute), resulting which i was facing the problem of timeout. so i increased the timeout value in the httpd.conf as "TimeForCGI = 180" but still the problem persists.
and i am sure that the time taken by whole process is far less than 180 secs.

i am able to execute the cgi by setting the environment variable, which runs fine.

i am attaching the logs of the server:
access log:
10.112.79.106|Thu 01 Jan 1970 00:08:16 +0000|304|0|admin|GET /webpages/images/loading.gif HTTP/1.1|Accept: */*|Referer: http://10.112.79.199/webpages/index.html|Accept-Language: en-us|UA-CPU: x86|Accept-Encoding: gzip, deflate|If-Modified-Since: Tue, 14 Jan 2003 06:56:51 GMT|User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)|Host: 10.112.79.199|Connection: keep-alive

10.112.79.106|Thu 01 Jan 1970 00:08:22 +0000|500|0|admin|GET /webpages/controller.cgi?subservice=NM_Web_VlanPortSettings&opCode=set&port_id=10&port_id=10&pvid=1&portMode=2&vlanIDs=&ingressFiltering=Disabled&acceptableFrameType=All HTTP/1.1|Accept: */*|Accept-Language: en-us|Referer: http://10.112.79.199/webpages/index.html|UA-CPU: x86|Accept-Encoding: gzip, deflate|User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)|Host: 10.112.79.199|Connection: keep-alive


error log:
Thu 01 Jan 1970 00:08:21 +0000|10.112.79.106|/mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/client/webpages/controller.cgi|CGI timeout



please help to rectify the problem.


My httpd.conf files is

# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
#ServerId = www-data
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/log/hiawatha/system.log
GarbageLogfile = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/log/hiawatha/garbage.log


# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
Port = 80
Interface = 0.0.0.0
maxKeepAlive = 160
}

# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications. Use the 'php-fcgi'
# tool to start PHP as a FastCGI daemon.
#
CGIextension = cgi


# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 0.0.0.0
WebsiteRoot = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/client

StartFile = login.html
#AccessLogfile = /var/log/hiawatha/access.log
#ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi

# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
VirtualHost {
Hostname = 0.0.0.0
WebsiteRoot = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/client
StartFile = login.html
AccessLogfile = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/log/access.log
ErrorLogfile = /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/log/error.log
ExecuteCGI = yes
TimeForCGI = 180
}

# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
Directory {
Path = /webpages/
ExecuteCGI = yes
passwordFile = basic: /mnt/nfs/MGMT/WebMgmtMay12/lsi-hiawatha/var/www/client/.passwords
# UploadSpeed = 10,2
}

Hugo Leisink
24 May 2009, 01:04
You have a virtual host that has the same hostname as the default website section. Just remove the virtual host (which you don't seem to be using) and add the TimeForCGI to the default website section.
Shashank
24 May 2009, 15:52
Thanks Hugo.

We have also tried to debug the problem our side. When we put debug statment in code, we found that webserver by default is taking timout of only 5 sec. We will put TimeForcgi in our default website section and would let you know the results.

we have sometime found one anoither issue. When we opened the errorlogs, we found the log there

can't open /dev/null

I have tried to scan your code but I did not find this statement in your code ( even not maching to can't open). I can make out the logic behind this error but is it possible for you to tell in which conditions this error cab happen.




Hugo Leisink
24 May 2009, 17:33
That's not an error generated by Hiawatha, so it must be coming from your CGI program. Perhaps because of a failed system call.
This topic has been closed.