Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Memory keeps increasing when user request data whose size < 1M (outbuf_overflow default ) #111
My server program runs on windows(32bit) with Waitress + Pyramid.
The ab command looks like below
The issue only happen in keep alive mode and data size is smaller than 1M.
while True: outbuf = self.outbufs # use outbuf.__len__ rather than len(outbuf) FBO of not getting # OverflowError on Python 2 outbuflen = outbuf.__len__() if outbuflen <= 0: # self.outbufs[-1] must always be a writable outbuf if len(self.outbufs) > 1: toclose = self.outbufs.pop(0) try: toclose.close() except: self.logger.exception( 'Unexpected error when closing an outbuf') continue # pragma: no cover (coverage bug, it is hit) else: # issue here, when outbuflen < 0, outbufs should be clear at least dobreak = True
I added a line code in the marked place, then the issue could be workaround, please check if it is a reasonable fix:
else: outbuf.prune() dobreak = True
Create a PR for this.
Only potential improvement I see here:
Although, that would penalize all other responses to possibly slower buffers due to one response being larger than 1MB.
Either way, adding the