[Patches] [ python-Patches-558547 ] SocketServer: don't flush closed wfile

noreply@sourceforge.net noreply@sourceforge.net
Wed, 05 Jun 2002 18:25:47 -0700


Patches item #558547, was opened at 2002-05-21 16:07
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=558547&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Anthony Baxter (anthonybaxter)
Assigned to: Nobody/Anonymous (nobody)
Summary: SocketServer: don't flush closed wfile

Initial Comment:
I've found the following patch (well, ok, subclassed,
but the patch is the same) makes SocketServer more 
robust. If wfile is already closed (prior to the 
finish() method being called), don't try to flush()
it. 



----------------------------------------------------------------------

>Comment By: Anthony Baxter (anthonybaxter)
Date: 2002-06-06 11:25

Message:
Logged In: YES 
user_id=29957

I'm not _entirely_ sure why it happens that finish() gets called
twice - I suspect some form of race condition. Since many/most
other similar functions in the python library silently ignore a 
close()-type operation (e.g. file.close(); file.close()). As
far as
the 'closed' attribute, well, yes, someone could subclass 
StreamRequestHandler.setup, and leave
StreamRequestHandler.finish
as-is. But then, it's only got two methods, so this is
highly unlikely.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-06-02 22:44

Message:
Logged In: YES 
user_id=21627

Can you explain how this problem can ever occur? I.e. why
would there be two calls to finish?

Also, is there a guarantee that every thing returned by
makefile has a .closed attribute?

----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2002-05-21 16:25

Message:
Logged In: YES 
user_id=29957

mm. i typ reel gud sometimes.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=558547&group_id=5470