Problems with FastCGI filesm - CLOSE_WAIT

Jonathan Gifford (jgifford@looksmart.com)
Wed, 11 Jun 1997 16:29:48 +1000

Message-Id: <3.0.32.19970611162647.006d1584@mail>
Date: Wed, 11 Jun 1997 16:29:48 +1000
To: fastcgi-developers@OpenMarket.com
From: jgifford@looksmart.com (Jonathan Gifford)
Subject: Problems with FastCGI filesm - CLOSE_WAIT

Hi,

I'm having some problems which I suspect are related to FastCGI and its
file handling. What I'm trying to do is open a log file inside a fastcgi
process, and write to that log file whenever I detect a problem with the 
process (illegal request, etc). The problem is that when I forceably close
the sockets to the Apache server on which the fcgi process is running, each 
socket goes into a CLOSE_WAIT state. If I don't use the log file, I don't
see this problem. Eventually, the sockets close properly, but we're getting
too many of these things to just ignore - they jam up our server. I've 
tried using both stdio.h and fastcgi_stdio.h to open/use/close the file, 
but this has no effect. The file is behaving properly in all cases (it 
opens, gets written to, and closes perfectly ok). Are there any known 
problems with file i/o in fastcgi that could explain this behaviour? Am
I doing something stupid here (I've seen example code which does similar
things in the messages on this list, so I assume its supposed to be ok)?
Any help much appreciated,

jon

P.S. This is running on a Sun Enterprise Server 300, with Solaris 2.5.1,
and using the latest Apache server, and the file code is standard C++
fopen, fprintf, fclose stuff

jgifford@looksmart.com.au		ph: +61 3 9602 2022
		LookSmart International Pty Ltd