SocketServer and broken ThreadingMixIn - patch for 2.1.1c1

Michael Ströder michael at stroeder.com
Wed Jul 18 10:21:52 EDT 2001


Stian Soiland wrote:
> 
> As known, in Python 2.1 the SocketServer.ThreadingMixIn
> does not work, and thereby SocketServer.ThreadingTCPServer
> etc. are broken as well.

I'm very glad that you took the discussion to the news group since
the SourceForge bug tracking page is not a discussion forum.

> However, the fix simply removes close_request()
> for threaded servers, as the process_request()
> is overridden. The overriden process_request()
> simply starts final_request() (doing the actual
> work), but does not call close_request()
> afterwards.
> 
> This means that there is a difference between
> threaded servers and non-threading servers.

I agree with Guido that it does not hurt to call close_request()
method more than once. Therefore your handler thread can easily call
close_request() without being incompatible to single-threaded
(checked it myself) or forking mode (did not check myself yet).

Ciao, Michael.



More information about the Python-list mailing list