How do I keep my application from blocking on input?

Robert V. Head (robh@ninny.digicool.com)
Fri, 19 Jul 1996 17:21:10 -0400

Date: Fri, 19 Jul 1996 17:21:10 -0400
Message-Id: <9607192121.AA22559@ninny.digicool.com>
From: "Robert V. Head" <robh@ninny.digicool.com>
To: fastcgi-developers@openmarket.com, rob@digicool.com, jim@digicool.com,
Subject: How do I keep my application from blocking on input?


	I'm trying to migrate an HTTP/HTML chatroom-type application
to use FastCGI.  The application relies on shared state among a number
of users and is designed to run as a single process (prior to FastCGI,
we had been using a proprietary FastCGI-like middleware to communicate
with a long-running process.)  I was under the impression that the
server did some buffering of incoming requests and wouldn't send the
request to the handling process until it was completely read in or
overran the buffer.  I was dismayed to discover that this doesn't seem
to be the case, and that I'm able to hang the application just by
telnetting to the web-server, manually entering a post request, and
not entering the data for the request body.  This isn't merely an
academic concern; on a machine running a beta version of the software
I've noticed long delays where the application process is blocking even
though there are pending requests waiting to be serviced.  

	In the interim, I'm going to modify the application to use
only the GET method.  I'm hoping that someone will be able to (a)
confirm my diagnosis of the problem, and (even better) (b), suggest a
workaround or fix.  I'm aware that the recommended model for developing
FastCGI applications is to use an array of handler processes instead
of just one monolithic process, but I'd certainly like to avoid having
to rewrite this application to share state among processes.  The
problem I've described would also seem to break the "process affinity"
functionality.

	If it helps, I'm using the OpenMarket server and the libfcgi
that comes with it.  Thanks very much for your time.

-- 
Robert V. Head, Software Engineer     | "And God said, 'Let there be light.',
Digital Creations, L.C. (540)371-6909 |  and so there was.  And then God
910 Princess Anne Street, Suite 300   |  created humans to aid in writing
Fredericksburg, VA 22401              |  the documentation."