[PATCH 2 of 2] commandserver: use selector2

Augie Fackler raf at durin42.com
Sat Jul 15 12:44:55 EDT 2017


> On Jul 15, 2017, at 2:41 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> On Fri, 14 Jul 2017 21:18:48 -0700, Jun Wu wrote:
>> Excerpts from Yuya Nishihara's message of 2017-07-15 12:37:39 +0900:
>>> On Fri, 14 Jul 2017 20:27:27 -0700, Jun Wu wrote:
>>>> # HG changeset patch
>>>> # User Jun Wu <quark at fb.com>
>>>> # Date 1500089181 25200
>>>> #      Fri Jul 14 20:26:21 2017 -0700
>>>> # Node ID a6545c15171810059596259f60574011184c3412
>>>> # Parent  5664763de82b48ca6882bbb624d01d467b4920d0
>>>> # Available At https://bitbucket.org/quark-zju/hg-draft 
>>>> #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r a6545c151718
>>>> commandserver: use selector2
>>>> 
>>>> Previously, commandserver was using select.select. That could have issue if
>>>> _sock.fileno() >= FD_SETSIZE (usually 1024), which raises:
>>>> 
>>>>  ValueError: filedescriptor out of range in select()
>>> 
>>> Can we get around it without vendoring selector2, by using poll() for example?
>> 
>> poll is not available on OS X, which we need to support.
> 
> Oh, miserable fork of BSD.
> 
>> I tried to write some lightweight wrapper around them, then discovered I
>> was basically reinventing things. SocketServer has too many issues and is
>> over complicated for our usecase, but the Python 3 "selectors" interface
>> looks not that bad. So I think it's okay to reuse a mature library.
> 
> Yeah, selectors API seems to do the right thing.

I agree - I had known about this, but forgot it existed. Kyle or Rodrigo hit the same select() issue recently, so I’m happy to see this fixed. Thanks!

> 
> Queued, thanks.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list