6 messages in ru.sysoev.nginxRe: SSL FD Leak
FromSent OnAttachments
Ben MaurerDec 30, 2007 12:47 pm 
Ben MaurerDec 30, 2007 2:11 pm 
Ben MaurerDec 30, 2007 2:55 pm 
Ben MaurerJan 3, 2008 9:37 am 
Igor SysoevJan 4, 2008 12:32 am.Other
Igor SysoevJan 4, 2008 12:43 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: SSL FD LeakActions...
From:Ben Maurer (bmau@public.gmane.org)
Date:Dec 30, 2007 2:11:41 pm
List:ru.sysoev.nginx

Ben Maurer wrote:

Hi,

On a server that has quite a few SSL connections, I started to notice that FDs were leaking. I set the load balancer in front of nginx to stop sending new requests to one server for a few minutes (to let the keepalive time expire) and found that there were a few thousand FDs open. netstat says that there are many sockets in the CLOSE_WAIT and ESTABLISHED state for the SSL server. Many of them have data in receive queue.

Any ideas what might cause this? This is an up-to-date 0.5.x install.

Some progress on debugging this -- it may have to to do with the deferred setting.

I've managed to get straces like this:

accept(6, {sa_family=AF_INET, sin_port=htons(35327), sin_addr=inet_addr("127.0.0.1")}, [16]) = 92 ioctl(92, FIONBIO, [1]) = 0 recv(92, 0xbf9c6c2b, 1, MSG_PEEK) = -1 EAGAIN (Resource temporarily unavailable)

by using:

ab -c500 -n2000 https://localhost:8095/

and aborting in the middle. It seems that these straces are the ones that result in leaked FDs. The trace really doesn't make much sense to me. Deferred accept promises that the socket only goes into accept once it has data or if it's ready to be closed. Neither of these should result in an EAGAIN. Regardless, it seems the problem is that the FD never gets added to epoll at this point.

- Ben