On 18/01/2010, at 16:43, Juan J. Martínez wrote: > El lun, 18-01-2010 a las 16:08 +0100, Alvaro Lopez Ortega escribió: >> On 18/01/2010, at 15:51, Juan J. Martínez wrote: >>> El lun, 18-01-2010 a las 15:30 +0100, Juan J. Martínez escribió: >>>> [...] >>>> But I insist: if there's an open connection, it must appear in netstat, >>>> and it's not the case here. >>>> >>>> I've disabled the keep alive for two vhost with some traffic. One serves >>>> a PHP site and the other one is a HTTP proxy. >>> >>> OK, it looks light it might be related to the http proxy and the >>> keep-alive between the http proxy requests and the proxyfied >>> application. >>> >>> And the weird thing is that it looks like a fd leak, because there isn't >>> a open connection associated to that fd (according to netstat). >> >> The proxy maintains a poll of open connections. If the number of descriptors >> does not grow I'd assume that's the reason. >> >>> I'll try to peep into handler_proxy.c tonight. > > I did a quick test: > > 1. Ask for a proxyfied page > 2. Wait ~15 secs (it's the keep-alive timeout for the proxyfied app) > 3. Check netstat: shows CLOSE_WAIT/FIN_WAIT_2 state for the connections > (one for cherockee and the other for the proxyfied app, respectively) > 4. fstat shows the socket is open (we know it's not true, according to > netstat!)
Let's say it's being closed. It's between both states. > 5. Ask for another proxyfied page > 6. Here you are! A new wasted socket! (I guess it's the previous one) Does it turn into a file descriptor leak if you request a few hundred pages? > A can reproduce it every time. > The question is: is this the correct behavior? Cherokee's proxy keeps a connection poll. The connections in that poll are supposed to be open, so the server can reuse then and save a three-way TCP handshake. However, it has no way to know whether those connections are actually open or if the remote peer has performed a socket shutdown (that's where the FIN_WAIT_2 state comes from). Due to this situation, Cherokee supposes the connections to be open. In case a connection were closed, it'd simply close it and open a new one. If there were a file descriptor leak, this would be most likely the buggy piece of code. But before I continue speculating, it'd be important to know whether the leak actually exist. Does making a hundred thousand requests to the proxy make any difference? Are more descriptors being left opened? -- Octality http://www.octality.com/ _______________________________________________ Cherokee mailing list [email protected] http://lists.octality.com/listinfo/cherokee
