danger: FCGIServer.py rev 1.5 breaks fastcgi for me.
I'm running Zope on a Linux box (redhat 5.2) and have mod_fastcgi_SNAP_Oct06 compiled into Apache 1.3.9 on a Solaris x86 box. This patch, from FCGIServer.py r1.4 to r1.5 utterly breaks FCGI support. Any attempt to connect via FCGI makes zope go into an infinite loop, gobbling up memory. Yes, this is in the collector now, but it's worth mentioning it to zope-dev so anyone else who is trying to make this work doesn't end up screaming and ranting... (As an aside - how do I get CVS to checkout a particular revision of a particular file? Can I do this?) (Aside2: classic.zope.org/cgi-bin/cvsweb.cgi is just hanging for me... :( the log entry for this revision: revision 1.5 date: 1999/11/22 14:48:07; author: brian; state: Exp; lines: +9 -1 Added P.Eby patch to deal with IRIX cgi-fcgi where the client doesnt seem to know when its done sending stdin and ZServer hangs waiting for it. The patch makes ZServer ignore stdin if there is no Content-Length and makes it stop looking if Content-Length or more bytes have already been read. ---------------------------- patch from r1.4 to r1.5 Index: FCGIServer.py =================================================================== RCS file: /cvs-repository/Zope2/ZServer/FCGIServer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FCGIServer.py 1999/11/16 02:25:44 1.4 +++ FCGIServer.py 1999/11/22 14:48:07 1.5 @@ -430,6 +430,10 @@ elif rec.recType == FCGI_PARAMS: if rec.contentLength == 0: # end of the stream self.remainingRecs = self.remainingRecs - 1 + self.content_length=string.atoi(self.env.get( + 'CONTENT_LENGTH','0')) + if self.content_length==0: + self.remainingRecs = self.remainingRecs - 1 else: self.env.update(rec.values) @@ -447,6 +451,10 @@ self.stdin=t self.using_temp_stdin=1 self.stdin.write(rec.content) + self.content_length = self.content_length - rec.contentLength + if self.content_length <= 0: + self.remainingRecs = self.remainingRecs - 1 + # read some filter data elif rec.recType == FCGI_DATA: @@ -457,7 +465,7 @@ # We've processed the record. Now what do we do? - if self.remainingRecs: + if self.remainingRecs > 0: # prepare to get the next record self.setInitialState()
At 11:49 AM 11/29/99 +1100, Anthony Baxter wrote:
I'm running Zope on a Linux box (redhat 5.2) and have mod_fastcgi_SNAP_Oct06 compiled into Apache 1.3.9 on a Solaris x86 box. This patch, from FCGIServer.py r1.4 to r1.5 utterly breaks FCGI support. Any attempt to connect via FCGI makes zope go into an infinite loop, gobbling up memory.
I think I know what the problem is, and it's my fault. What's probably happening is that it's trying to launch two publishers on the same request, due to the STDIN record(s). Would you try out the patch below and tell me if that fixes it? Please try some POST requests as well as GET requests. Thanks, and my apologies for the inconvenience. I sent in a patch that fixed my problem, but I didn't code it properly for the "correct" case. Index: FCGIServer.py =================================================================== RCS file: /cvs-repository/Zope2/ZServer/FCGIServer.py,v retrieving revision 1.5 diff -u -r1.5 FCGIServer.py --- FCGIServer.py 1999/11/22 14:48:07 1.5 +++ FCGIServer.py 1999/11/29 15:42:58 @@ -439,6 +439,9 @@ # read some stdin data elif rec.recType == FCGI_STDIN: + if self.remainingRecs <= 0: # prevent re-entry + self.setInitialState() + return if rec.contentLength == 0: # end of the stream self.remainingRecs = self.remainingRecs - 1 else:
participants (2)
-
Anthony Baxter -
Phillip J. Eby