On Fri, Jan 15, 2016 at 12:37:54PM +0100, Christian Stieber wrote: > I recently looked into the problem that spamming my server with > connections would even prevent it from responding to the CTRL-C signal. > First thing I did was to add priorities to my events, with signals getting > the highest and sockets getting the lowest prio. Much to my surprise, that > didn't change anything at all. > > After some headscratching, and since I'm using EVLOOP_ONCE anyway to > implement a delayed disposal of objects, I threw some > event_base_loopbreak() calls into the code to see if that would help. > Again, it still didn't get my Ctrl-C until I stopped spamming connections > at the server. > > More reading got me to the "complicated event base", and the > event_config_set_max_dispatch_interval() option. Needless to say, it > didn't improve things. > > I was already concerned that the evconnlistener didn't support priorities, > but even at default priority it should be lower than the signal priority > as I have 4 priority levels. So, I started to dig into the libevent code > itself. > > Turns out, the evconnlistener (listener.c) accepts connections until it > gets an error, apparently (I can't say I went through all the libevent > code) > without checking for things like event_config_set_max_dispatch_interval. > My build now applies a patch to the libevent build that just breaks the > loop after 10 accepts, and that finally got my signals noticed. > > I've attached the patch for purely informal reasons; a real change should > not break the loop after 10 tries but use the parameters that libevent > already has. For now, I just needed something that works, and doesn't > require me to spend days researching how libevent is supposed to work > internally.
Hi Christian, Thanks for reporting this! You can take a look at: - https://github.com/azat/libevent/commit/cee579654f3dafe In the meantime I will try to come with a normal solution (maybe some flag LEV_OPT_ONCE or some threshold). Thanks, Azat. *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
