On Sat, Jun 06, 2015 at 04:22:06AM +0000, Tomer Heber wrote: > Hi Mark, > > > Thanks for your reply. I agree about increasing the limit/or that I have a > descriptor leak. What worries me is the infinite loop. > > > I'll have a look in my code and in libevents code. If I find anything > intresting or manage to reproduce it, I'll update.
General debugging should easily point out the problem here: lsof, sudo netstat -anp (look for ESTAB, rx/tx queue len), try A really really really old program I wrote that I still useful for quick network statistics (https://github.com/ellzey/trafan), ls -la /proc/<pid>/fd, htop (configure your bars for ioin/ioout), atop. Try lsof, do you have a bunch of sock/fdpairs/af_unix descriptors open you don't need? If your program is being spawned by another program, make sure the parent fd's are setup with FD_CLOEXEC, (I've encountered this with older versions of nodejs). The big question: are you using LEV_OPT_CLOSE_ON_FREE? If you're not, you have to close sockets manually. I don't see the infinite loop in your gdb output; I see something trying to make a connection, the accept fails due to fd resource limits, and defaults to sending an "event_sock_warn". I would suggest setting read/write timeouts on your accepted connections (if you are resource limited); or setting the evconnlistener's errorcb, and adding some logic to log various stats about the process. One other thing you could do (after setting the errorcb) is to evconnlistener_disable(), and wait (timer event or a client to disconnect/timeout/error/whatever (eventcb)), check your resources, and if all is good, call evconnlistener_enable(). *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
