[libvirt] [PATCH 1/2] RPC: Don't accept client if it would overcommit max_clients

Michal Privoznik mprivozn at redhat.com
Thu Jul 25 14:43:52 UTC 2013


On 25.07.2013 16:37, Daniel P. Berrange wrote:
> On Thu, Jul 25, 2013 at 04:23:32PM +0200, Michal Privoznik wrote:
>> Currently, even if max_client limit is hit, we accept() incoming
>> connection request, but close it immediately. This has disadvantage of
>> not using listen() queue. We should accept() only those clients we
>> know we can serve and let all other wait in the (limited) queue.
>> ---
>>  src/rpc/virnetserver.c        | 40 ++++++++++++++++++++++++++++++++++++++++
>>  src/rpc/virnetserverservice.c |  9 +++++++++
>>  src/rpc/virnetserverservice.h |  4 ++++
>>  3 files changed, 53 insertions(+)


>>  
>> +    if (svc->dispatchCheckFunc &&
>> +        svc->dispatchCheckFunc(svc, sock, svc->dispatchOpaque) < 0) {
>> +        /* Accept declined */
>> +        goto cleanup;
>> +    }
>> +
> 
> Rather than having this callback, can we not simply change virNetServerAddClient()
> to call virNetServerUpdateServices(srv, false); when a new client causes us to hit
> the max limit ?
> 

No, because that callback is called *after* accept() which I am trying
to avoid.

Michal

> Daniel
> 




More information about the libvir-list mailing list