cube-drone / pierc

A python bot that logs IRC channels, and a PHP/JS interface for browsing said logs.
http://classam.github.com/pierc/
Other
52 stars 24 forks source link

DNS resolution failures are not gracefully handled #25

Open radiumsoup opened 10 years ago

radiumsoup commented 10 years ago

If a host's dns resolution fails for any reason (ISP DNS temporarily down, network issues, etc.) when the bot tries to connect, it will try only once to connect instead of trying repeatedly.

I had a switch changeover and my host lost network connectivity for a bit. Bot got disconnected, tried to reconnect while the connection was still down, and was met with:

Server Not Connected! Let's try again!
Traceback (most recent call last):
  File "pierc.py", line 200, in <module>
    main()
  File "pierc.py", line 192, in main
    mysql_settings["password"] )
  File "pierc.py", line 61, in __init__
    self.connect(self.server, self.port, self.nick, self.password, self.username, self.ircname, self.localaddress, self.localport, self.ssl, self.ipv6)
  File "/var/www/private-services/pierc/bot/irclib.py", line 1084, in connect
    localaddress, localport, ssl, ipv6)
  File "/var/www/private-services/pierc/bot/irclib.py", line 439, in connect
    raise ServerConnectionError, "Couldn't connect to socket: %s" % x
irclib.ServerConnectionError: Couldn't connect to socket: [Errno -3] Temporary failure in name resolution

Where it happily stayed disconnected until the channel folks noticed and complained, and I manually restarted it.