[Twisted-Python] [cpushare at cpushare.com: CPUShare Exception]

Andrea Arcangeli andrea at cpushare.com
Thu Jul 7 08:22:56 EDT 2005


Hello,

I wrote the below code in my server:

from twisted.python import log

# local
from cpushare.mail import send_exception

class cpushare_logging_observer_class(object):
	def __init__(self, factory):
		self.factory = factory
	def start(self):
		if self.factory.production:
			log.addObserver(self.emit)
	def stop(self):
		if self.factory.production:
			log.removeObserver(self.emit)
	def emit(self, eventDict):
		edm = eventDict['message']
		if not edm:
			if eventDict['isError'] and eventDict.has_key('failure'):
				send_exception(eventDict['failure'])

to receive exceptions by email like the below if (send_exception sends me
an sms for the very first exception too). I do a very similar thing in
nevow, but in nevow I handle it through the nevow layer, not through
twisted.

Now to me it seems that the below exception isn't really interesting to
me, any client could generate it by injecting garbage in the ssl
connection.

Does anybody has suggestions on the best way to filter out all
OpenSSL.SSL.Error exceptions before calling send_exception in the above
code? Thanks!

(twisted is great ;)

----- Forwarded message from cpushare at cpushare.com -----

Date: Thu,  7 Jul 2005 14:14:08 +0200 (CEST)
From: cpushare at cpushare.com
To: andrea.kernel at tiscali.it
Subject: CPUShare Exception
X-Mailbox-Line: From nobody Thu Jul  7 14:14:07 2005

Traceback (most recent call last):
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/python/log.py", line 43, in callWithContext
    
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/python/context.py", line 59, in callWithContext
    
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/python/context.py", line 37, in callWithContext
    
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/internet/pollreactor.py", line 160, in _doReadOrWrite
    
--- <exception caught here> ---
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/internet/tcp.py", line 111, in doRead
    
  File "/home/build/bin/i686/python-20050707/lib/python2.4/site-packages/twisted/internet/tcp.py", line 339, in doRead
    
OpenSSL.SSL.Error: [('SSL routines', 'SSL3_READ_BYTES', 'ssl handshake failure')]

----- End forwarded message -----




More information about the Twisted-Python mailing list