Hi,
I use pyICQ-t for some days now. Because I only have a few users, that
sleeps all at night and turn off their PC, I noticed, that after time
with no activity on the transport, the MySQL server closes the
connection. The pyICQ-t tries to recover the connection with
self.db.ping() but this don't work.
One way is to change the timeout of the MySQL server to something very
big, that never get reached. But I think thats only a workaround. I
tried already to modify the source in that way, that the transport
will reconnect if the connection is closed. But because I don't now
much about python, I don't get it. I tried to use the result of ping()
to check weather the connection is up or down. But even on ping() the
transport get an exception. Can you please give me an example how to
catch an exception in python? In c++ I would use something like try and
catch. But I don't now the right syntax in python.
Thanks
Alexander Sulfrian
attached:
logfile after the MySQL server closed the connection (this messages are
repeated every 2 seconds)
[2007-02-13 14:14:23] Starting factory <twisted.xish.xmlstream.XmlStreamFactory
instance at 0xb7d8fe8c>
[2007-02-13 14:14:23] INFO :: :: PyTransport :: componentConnected ::
{'xmlstream': <twisted.xish.xmlstream.XmlStream instance at 0xb673ce8c>} ::
[2007-02-13 14:14:23] Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line
53, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line
38, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/lib/python2.4/site-packages/twisted/python/context.py",
line 59, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python2.4/site-packages/twisted/python/context.py",
line 37, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File
"/usr/lib/python2.4/site-packages/twisted/internet/pollreactor.py", line 164,
in _doReadOrWrite
why = selectable.doRead()
File "/usr/lib/python2.4/site-packages/twisted/internet/tcp.py", line
348, in doRead
return self.protocol.dataReceived(data)
File "/usr/lib/python2.4/site-packages/twisted/xish/xmlstream.py",
line 145, in dataReceived
self.stream.parse(buf)
File "/usr/lib/python2.4/site-packages/twisted/xish/domish.py", line
600, in parse
self.parser.Parse(buffer)
File "/usr/lib/python2.4/site-packages/twisted/xish/domish.py", line
638, in _onEndElement
self.ElementEvent(self.currElem)
File "/usr/lib/python2.4/site-packages/twisted/xish/xmlstream.py",
line 166, in onElement
self.dispatch(element)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
233, in dispatch
callbacklist.callback(object)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
37, in callback
methodwrapper(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
21, in __call__
self.method(*nargs, **nkwargs)
File
"/usr/lib/python2.4/site-packages/twisted/words/protocols/jabber/component.py",
line 48, in _handshakeEvent
self.xmlstream.dispatch(self.xmlstream,
xmlstream.STREAM_AUTHD_EVENT)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
227, in dispatch
self._eventObservers[(priority, event)].callback(object)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
37, in callback
methodwrapper(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/twisted/xish/utility.py", line
21, in __call__
self.method(*nargs, **nkwargs)
File
"/usr/lib/python2.4/site-packages/twisted/words/protocols/jabber/component.py",
line 137, in _authd
c.componentConnected(xs)
File "/usr/lib/python2.4/site-packages/pyicq-t/src/main.py", line
260, in componentConnected
self.sendInvitations()
File "/usr/lib/python2.4/site-packages/pyicq-t/src/main.py", line
380, in sendInvitations
for jid in self.xdb.getRegistrationList():
File "/usr/lib/python2.4/site-packages/pyicq-t/src/xdb/mysql.py",
line 58, in getRegistrationList
if not self.db.ping() == 0:
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
[2007-02-13 14:14:23] INFO :: :: PyTransport :: componentDisconnected :: {} ::
[2007-02-13 14:14:23] <twisted.internet.tcp.Connector instance at 0xb7607aec>
will retry in 3 seconds
[2007-02-13 14:14:23] Stopping factory <twisted.xish.xmlstream.XmlStreamFactory
instance at 0xb7d8fe8c>
_______________________________________________
py-transports mailing list
py-transports@blathersource.org
http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports