Re: [Twisted-Python] problem with long-running threads]
Oops... I forgot the ,None part to getattr. The following patch seems to have solved the "symptom" below, but I wonder if I've just masked a problem. Clark --- http.py.orig Tue Feb 25 13:15:01 2003 +++ http.py Tue Feb 25 13:16:55 2003 @@ -556,8 +556,10 @@ self.write('') # log request - if hasattr(self.channel, "factory"): - self.channel.factory.log(self) + chan = getattr(self,"channel",None) + if chan: + fact = getattr(chan,"factory",None) + if fact: fact.log(self) self.finished = 1 if not self.queued: On Tue, Feb 25, 2003 at 04:19:50AM +0000, Clark C. Evans wrote: | I've been getting the following traceback in my log files... any ideas? | I'm using a separate thread for a long-running-query... | | Traceback (most recent call last): | File "/usr/local/lib/python2.2/site-packages/twisted/internet/default.py", | line 121, in mainLoop | | File "/usr/local/lib/python2.2/site-packages/twisted/internet/base.py", | line 343, in runUntilCurrent | | File | "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", | line 162, in callback | | File | "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", | line 213, in _startRunCallbacks | | --- <exception caught here> --- | File | "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", | line 227, in _runCallbacks | | File "server.py", line 13, in bad | req.finish() | File | "/usr/local/lib/python2.2/site-packages/twisted/protocols/http.py", | line 559, in finish | | exceptions.AttributeError: Request instance has no | attribute 'channel' | | | | | _______________________________________________ | Twisted-Python mailing list | Twisted-Python@twistedmatrix.com | http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python ----- End forwarded message -----
On Tue, 25 Feb 2003 19:20:31 +0000 "Clark C. Evans" <cce@clarkevans.com> wrote:
Oops... I forgot the ,None part to getattr.
The following patch seems to have solved the "symptom" below, but I wonder if I've just masked a problem. Clark
There's a lready a patch in CVS - but you have a bug in your code. See my other comment.
participants (2)
-
Clark C. Evans -
Itamar Shtull-Trauring