[Twisted-Python] Odd behavior in IRC logbot

Andrew Bennetts andrew-twisted at puzzling.org
Sat Oct 25 12:21:38 EDT 2003


On Sat, Oct 25, 2003 at 10:07:42AM -0400, Phillip J. Eby wrote:
> I've been using a slightly modified version of the IRC logging bot example 
> to log traffic on #peak.  I've noticed, however, that it occasionally seems 
> to hang, and has to be manually restarted.  As a workaround, I've set up a 
> cronjob to kill and restart it daily, but that seems like a kludge.
> 
> Does anybody know why this happens?  Is there some kind of reconnect 
> timeout such that it'll give up on reconnecting if the server it's trying 
> to connect to is down?  I've noticed that the hang behavior seems to be 
> correlated with global announcements about shutting down the IRC netwrok.

The ClientFactory subclass in doc/examples/ircLogBot.py is very simple:
    ...
    def clientConnectionLost(self, connector, reason):
        """If we get disconnected, reconnect to server."""
        connector.connect()

    def clientConnectionFailed(self, connector, reason):
        print "connection failed:", reason
        reactor.stop()
    ...

Perhaps clientConnectionFailed is being triggered, instead of
clientConnectionLost (which has no delay at all, as you can see)?  (The docs
don't clearly say this, but ccF is called when there was no connection
established, and ccL is called when a connection was made and then
disconnected).

(I'm presuming your slightly modified version hasn't changed the
LogBotFactory...)

-Andrew.





More information about the Twisted-Python mailing list