Message6123

Author zyasoft
Recipients amak, gdoutch, zyasoft
Date 2010-10-03.16:31:43
SpamBayes Score 7.007616e-09
Marked as misclassified No
Message-id <1286123505.27.0.534659402621.issue1660@psf.upfronthosting.co.za>
In-reply-to
Content
(First, I made the same change to not use port 0, since it didn't work on OS X. It's irrelevant to the memory leak regardless.)

SocketServer.py is directly pulled in from CPython. It's clear there's a programming flaw here that has been fixed in subsequent versions of CPython, when comparing 2.5 vs 2.7. So we should have this pattern of try-finally:

class BaseRequestHandler:
    def __init__(self, request, client_address, server):
        self.request = request
        self.client_address = client_address
        self.server = server
        self.setup()
        try:
            self.handle()
        finally:
            self.finish()

In 2.5, this is confused, so we have:

    def __init__(self, request, client_address, server):
        self.request = request
        self.client_address = client_address
        self.server = server
        try:
            self.setup()
            self.handle()
            self.finish()
        finally:
            sys.exc_traceback = None    # Help garbage collection

In general that last bit would be unnecessary in Jython, although it wouldn't hurt either.

However, it still seems like we have slow upwards trend in memory consumption. So we may have similar leaks occurring elsewhere in the socket support. More analysis needed!
History
Date User Action Args
2010-10-03 16:31:45zyasoftsetmessageid: <1286123505.27.0.534659402621.issue1660@psf.upfronthosting.co.za>
2010-10-03 16:31:45zyasoftsetrecipients: + zyasoft, amak, gdoutch
2010-10-03 16:31:45zyasoftlinkissue1660 messages
2010-10-03 16:31:43zyasoftcreate