On May 9, 2007, at 10:56 AM, Ian Bicking wrote:
> Brad Clements wrote:
>> On 9 May 2007 at 10:26, Shannon -jj Behrens wrote:
>>> On 5/9/07, Andrew Wilson <[EMAIL PROTECTED]> wrote:
>>>> This is a wierd one, to me. After serving 500 pages (exactly),
>>>> wphp starts
>>>> failing with the error: "connection refused". After serving this
>>>> many pages,
>>>> the PHP process refuses to accept any more connections on the
>>>> FCGI port.
>>> I'm just taking a wild guess:
>>>
>>> A 500 error means something is broken. Perhaps the server is
>>> killing
>> Maybe that's too wild a guess.
>> He said it fails after serving 500 requests. I don't think he's
>> saying it returns an HTTP 500 status code.
>
> Possible things might be a connection that isn't properly closed,
> or... well, that seems like the most likely thing. It might be PHP
> that does the limiting, or perhaps the OS. I haven't actually
> looked in fcgiapp much at all (Allan wrote that part), so I don't
> know how it manages those connections.
I believe there might be a socket leak around line 214 of wphp/
__init__.py:
# PHP doesn't start up *quite* right away, so we give it a
# moment to be ready to accept connections
while 1:
try:
sock = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
sock.connect(('127.0.0.1', self.fcgi_port))
except socket.error, e:
pass
else:
sock.close()
return
Basically, if php-cgi doesn't accept the connection immediately, one
or more sockets may be left hanging around. (They aren't being
explicitly closed.) Also, I'm not sure if it's necessary to re-create
the socket with each iteration of the loop?
Anyway, just a guess. I can't really test it out since I don't have
php-cgi compiled. There didn't seem to be any glaring leaks in
FCGIApp either, as its socket is created/closed before start_response
() is called.
Though it's interesting that it fails after exactly 500 requests. It
almost sounds like a config issue with php, perhaps some sort of max
requests setting?
- Allan
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users