[MERGE][158972] Don't use timeout in HttpServer

John Arbash Meinel john at arbash-meinel.com
Thu Nov 1 21:39:36 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "john" == John Arbash Meinel <john at arbash-meinel.com> writes:
> 
>     john> Vincent Ladeuil wrote:
>     >> We had a problem on Mac OS X since the first http test server
>     >> implementation.
>     >> 
>     >> It turns out it's due to the fact that the python http test
>     >> server we build upon use socket.makefile() internally and since
>     >> http://docs.python.org/lib/socket-objects.html says timeout and
>     >> makefile should not be mixed, we shouldn't.
>     >> 
>     >> Why didn't it break more obviously ? I don't know.
>     >> 
>     >> But this patch remove the timeout use and the test suite still
>     >> pass, and, more importantly, webdav test suite is passing again :)
>     >> 
>     >> This does not address
>     >> https://bugs.edge.launchpad.net/bzr/+bug/69978, it may make it
>     >> more prone to occur, but testing under both Gutsy and OS X didn't
>     >> triggered it.
>     >> 
>     >> Vincent
> 
>     john> I would actually rather avoid "makefile()" than
>     john> settimeout.
> 
> I don't feel like rewriting python httplib, so I guess that rules
> that out ;-)

Why not, you rewrote most of urllib2. :)

> 
>     john> If we can't make that work, then I'm okay with this.
> 
>     john> From what I remember, the main difference is that on
>     john> Linux, it can block waiting for the timeout, or issue
>     john> EAGAIN.
> 

...

> That's the theory and that is how it works under linux. But under
> OS X, you just get EAGAIN as long as you want, but never any data
> (at least for when there is a lot of data as in
> test_readv_with_adjust_for_latency).

hmm.. this seems a bit odd. I wonder why. I suppose it might refuse to buffer
if the request is larger than the buffer, but that seems a bit stupid to me.

Actually, I just realized something else. We don't have an explicit
"disconnect" request. So there is a question about how to kill the http server
thread. I suppose it just gets a socket disconnect?

I suppose that is your 'self.socket.shutdown'? That might be the big reason we
had the timeout in the past.

So overall, I think

BB:approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHKkeXJdeBCYSNAAMRAqMRAJ9jC9xGcjECfx3rpe2Ho5K2JYMR2ACdF4Q8
IjaqaYvzrg7i5PHGKx5vGIA=
=rlBG
-----END PGP SIGNATURE-----



More information about the bazaar mailing list