[PYTHON-CRYPTO] Memoryleak in SSL.Connection

Andre Reitz reitz at INWORKS.DE
Mon Mar 15 13:24:39 CET 2004


Hy all,

There is a memoryleak if you use
the function setblocking..... of SSL.Connection

e.g.:
  self._write_bio
  self._read_bio
...are bound instance methods, which referr to the Connection object

it seems that because of this backreference,
the cyclic garbagecollection would be needed to free
the Connection object,
but because of the __del__ method in Connection, it can 
never be freed.

This is fatal if used as a Server:) 
We have exactly this problem:
 When the Server runs one Week, the server
 consumes half of the memory.




Greetings, Andre'
And thank you very much in advance.






...
    sendall = send = write = _write_bio
    recv = read  = _read_bio

    def setblocking(self, mode):
        """Set this connection's underlying socket to _mode_."""
        self.socket.setblocking(mode)
        if mode:
            self.send = self.write = self._write_bio
            self.recv = self.read = self._read_bio
        else:
            self.send = self.write = self._write_nbio
            self.recv = self.read = self._read_nbio


Perhaps this should be done like this.....

    def setblocking(self,mode):
        self.blockingmode=mode
    ...
    def send(self,...):
        if self.blockingmode: return self._write_bio(...)
        return self._write_nbio(...)



Does anybody have a better idea?



-- 
__________________________________________________________________________

Als Technologieunternehmen konzipieren und entwickeln wir maßgeschneiderte Feedback- und
Monitoring-Systeme - wie beispielsweise Lösungen für Beschwerde- und Ideenmanagement.
Mit dem Inquery® Survey Server bieten wir eine der leistungsfähigsten Standardlösungen für
Online-Umfragen mit dem Schwerpunkt auf der Messung von Kundenzufriedenheit an.
__________________________________________________________________________


Inworks GmbH
Andre Reitz, Leiter Entwicklung
Hörvelsinger Weg 39, 89081 Ulm, Germany
Tel +49 (0) 731 / 93807-21
Fax +49(0)731/93807-18
Internet: http://www.inworks.de




More information about the python-crypto mailing list