[cpushare@cpushare.com: KLive Exception]
Hello, I've already sent it to David privately, but posting it here may have a larger audience (I imagine foom may be interested in it too). This is the first sms/email-exception since I deployed web2 in production (told you it would have been a good contribution to start testing it). It was harmless, but we've to fix it. Checking for self.stream is not None would be enough, but I suspect it would be the wrong fix. I mean, how can it happen that the stream is NULL in the _LogByteCounter? def close(self): if self.done: done=self.done; self.done=None done(False, self.len) self.stream.close() ^^^^^^^^^^^ was NULL btw, I'm going to add in the CPUShare-Twisted branch addCookie/isSecure to the request and setCookie to the response objects (if you start using mercurial you'll then get them by pulling my tree). ----- Forwarded message from cpushare@cpushare.com ----- Date: Sat, 21 Jan 2006 10:02:31 +0100 (CET) From: cpushare@cpushare.com Subject: KLive Exception X-Mailbox-Line: From nobody Sat Jan 21 10:02:31 2006 Traceback (most recent call last): File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 375, in _cbFinishRender File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 229, in callback File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 294, in _startRunCallbacks --- <exception caught here> --- File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/http.py", line 404, in writeResponse File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/log.py", line 41, in close exceptions.AttributeError: 'NoneType' object has no attribute 'close' ----- End forwarded message -----
I just got another (different) exception from web2: File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 375, in _cbFinishRender File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 229, in callback File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 294, in _startRunCallbacks --- <exception caught here> --- File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 365, in filterit File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 43, in preconditionfilter File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/http.py", line 242, in checkPreconditions twisted.web2.http.HTTPError: if request.method in ("HEAD", "GET"): # If it's a range request, don't allow a weak ETag, as that # would break. canBeWeak = not request.headers.hasHeader('Range') if notModified != False and matchETag(inm, canBeWeak): raise HTTPError(NotModifiedResponse(response)) ^^^^^ this one Here it looks like an exception isn't being trapped.
On Sun, Jan 22, 2006 at 03:23:48AM +0100, Andrea Arcangeli wrote:
I just got another (different) exception from web2:
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 375, in _cbFinishRender
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 229, in callback
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 294, in _startRunCallbacks
--- <exception caught here> --- File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/internet/defer.py", line 307, in _runCallbacks
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 365, in filterit
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/server.py", line 43, in preconditionfilter
File "/home/build/bin/i686/python-20060121/lib/python2.4/site-packages/twisted/web2/http.py", line 242, in checkPreconditions
twisted.web2.http.HTTPError:
if request.method in ("HEAD", "GET"): # If it's a range request, don't allow a weak ETag, as that # would break. canBeWeak = not request.headers.hasHeader('Range') if notModified != False and matchETag(inm, canBeWeak): raise HTTPError(NotModifiedResponse(response)) ^^^^^ this one
Here it looks like an exception isn't being trapped.
This one above seems just a side effect of the other bug just fixed, so the other fix should make this one go away too.
On Sun, Jan 22, 2006 at 03:01:52AM +0100, Andrea Arcangeli wrote:
Checking for self.stream is not None would be enough, but I suspect it would be the wrong fix. I mean, how can it happen that the stream is NULL in the _LogByteCounter?
Ok, looks like the response.stream can be null sometime (at least there is other code that contemplates this possibility) and we probably want to log those requests with null stream. So the obvious fix should be the right fix too: http://www.cpushare.com/hg/Twisted/?cs=57753be7d975 (click on the "raw" button to download a clean patch to apply to SVN if you don't want to use mercurial in the first place to pull the tree) Now looking into the other exception that I reported...
participants (1)
-
Andrea Arcangeli