Hallo Christoph, thanks for that. I've cheated a bit, I'm still using Webware-0.9.1. When trying to upgrade my Application to Webware-0.9.2, I realized that the Application breaks. I'll need to investigate this first (I'm using a homegrown JSONRpc Handler). Alternativly, I could change my Webware-0.9.1 according to your suggestions. I'll definatelly get back to you about this.
Stephan Christoph Zwerschke wrote: > Stephan Diehl schrieb: >> I'm a longtime user of WebWare. I just stumbled over some pretty >> strange problem. The Application running on Webware is a kind of >> Document Management system that can contain quite huge files (ISO >> images). When somebody is downloading such a file and cancels the >> download, the application eats up more and more memory. It looks like >> the application tries to deliver the content, but, instead of >> delivering it to the client (who's not longer there), caches >> everything in memory. This is the newest version of WebWare. > > > > I've done the following change: > > In WebKit/ThreadedAppServer.py > > > > 741 def flush(self): > > 742 """Flush stream. > > ... > > 753 while sent < reslen: > > 754 try: > > 755 sent += self._socket.send( > > 756 self._buffer[sent:sent+8192]) > > 757 except socket.error, e: > > 758 if e[0] == errno.EPIPE: # broken pipe > > 759 pass > > 760 elif hasattr(errno, 'ECONNRESET') \ > > 761 and e[0] == errno.ECONNRESET: > > 762 pass > > 763 else: > > 764 print "StreamOut Error: ", e > > 765 break > > 766 self.pop(sent) > > > > I've changed line 759 from 'pass' to 'raise', which now gives ugly > > tracebacks in the logs, but other than that, does what should happen > > anyway: cancel the download. > > Hi Stephan, > > thanks for the bug report. I think you're right, this is a problem. > > By the way, on Windows you get an ECONNABORTED error in the same > situation, not an EPIPE error. So I think ECONNABORTED should be treated > the same way as the other two errors in the flush method. > > For a fix of the problem, I suggest the following: > > In ASSStreamOut.py: > > Above the definition of the ASStreamOut class, insert: > > class ConnectionAbortedError(Exception): > pass > > Below, replace the 2 lines beginning: > > assert not self._closed, ... > > with: > > if self._closed: raise ConnectionAbortedError > > In ThreadedAppServer.py: > > Above the definition of the ThreadedAppServer class, insert: > >>from ASStreamOut import ConnectionAbortedError > > In the TASASStreamOut.flush() method, insert this line > before the break statement: > > self._closed = True > > To avoid the ugly tracebacks, insert the following lines between > the call of handler.handleRequest() and the following except:, > indented with the correct amount (both "excepts" on the same level): > > except ConnectionAbortedError: > if self._verbose: > sys.stdout.write('%5i %s connection aborted\n' > % (handler._requestID, timestamp()['pretty'])) > > If you confirm that this fixes your problems and nobody disagrees, I > will fix it this way in the trunk. > > > P.S.: I know this is quite a political issue, but is there a chance to > > change from tabs to spaces in Webware code? > > I think this question should go directly to Chuck, our BDFL who had been > strongly against this in the past. I vote for a change as well. > > -- Christoph > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/webware-discuss > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss