xmlrpc, httplib and SSL

Roger Binns rogerb at rogerbinns.com
Sun Mar 28 20:52:12 EST 2004


Skip Montanaro wrote:
> Can you submit a patch to SF which abstracts that into its own method
> ("end_request" or something similar?) which can be overridden.
[snip]
> That sounds like the main problem.  Sounds like getting the shutdown() call
> into its own overridable method would help a lot.

That doesn't help.  Basically what has happened is due to a defect
in Python (IMHO).  Because objects that include a destructor (__del__)
won't necessarily have the destructor called, and file/socket
handles are real operating system resources, the code has to manually
call close everywhere to ensure they aren't leaked (very reminiscent
of C memory management).  The calling of close() everywhere was
easiest done by assuming that there will be one transaction per
connection.  Add in the 'dup' behaviour I talked about in an
earlier message and it is really hard to fix all this.  Basically
there is manual handle management going on that really should
be handled correctly by the garbage collection system.  Additionally
M2Crypto does not support dup'ing a file handle.  Nor does 
the SSL builtin to Python 2.3, so the latter builds yet another
layer of reference counting framework.  IMHO it may require
new classes with new semantics, just as happened between
Python 1.5 and 2.0.

I *am not* volunteering to fix this.  I can't even test fixes
unless they test the whole thing since fixes in one small area
don't do me any good.  I also have the constraint of having to
work on 2.2 as well as 2.3.

However if someone wants to fix the *whole thing*, and not just
a call here or there, I will provide moral support and the 
lessons I learnt the hard way.

Roger





More information about the Python-list mailing list