[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Stop listening on http server when accept() returns Too Many Open Files



On Mon, Sep 20, 2010 at 2:09 PM, Simon Perreault
<simon.perreault@xxxxxxxxxxx> wrote:
> On 2010-09-20 13:53, Nick Mathewson wrote:
>>> Would the attached patch work?
>>
>> Looks okay to me.   Probably, you'd want to rename "ecb" to "errorcb"
>> or something; we don't use "ecb" to mean "error callback" anywhere
>> else.
>
> Sure, no problem. Also, I noticed a small typo:
>
> -void evconnlistner_set_error_cb(struct evconnlistener *lev,
> +void evconnlistener_set_error_cb(struct evconnlistener *lev,

Thanks.  Should I expect a revised patch, or should I try to remember
to fix this up myself.

>> Is there any way to write a unit test for this?  I don't see a good
>> one beyond passing in a bogus fd to provoke an ENOTSOCK or something
>> like that, which is not the exact situation we're facing here, but
>> which at least would make sure the callback is getting run properly.
>
> Having no idea what your test harness is capable of, couldn't one set
> ulimit -n some_low_value, start a listener, create connections until the
> error callback is called, and then ...?

Ick; that approach  *would* work, but it's mostly launched from C, so
instead of doing a ulimit -n, you're looking at a setrlimit, which
implies that we need to do the necessary autoconf stuff to see if we
_have_ getrlimit, etc.

I guess if we've gotta, we've gotta. :p

-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.