jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 86 forks source link

Failing to connect to Freenode #76

Closed jleclanche closed 8 years ago

jleclanche commented 8 years ago

I couldn't figure out why the library wouldn't connect, and then I tried the builtin testbot.py script.

python testbot.py irc.freenode.net:6697 #<channel> testbot19630 doesn't work.

By throwing some q() logs in there it looks like the connection's sockets are lost...

 0.2s process_once(<irc.client.Reactor object>, 0.2)
 0.2s   process_once: 
        self.sockets=[<socket.socket fd=4, family=AddressFamily.AF_INE...168.1.65', 38757), raddr=('91.217.189.42', 6697)>]
 0.2s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=<socket.socket fd=4, family=AddressFamily.AF_INE...168.1.65', 38757), raddr=('91.217.189.42', 6697)>
 0.3s -> None
 0.3s process_once(<irc.client.Reactor object>, 0.2)
 0.3s   process_once: self.sockets=[]
 0.3s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 0.5s -> None
 0.5s process_once(<irc.client.Reactor object>, 0.2)
 0.5s   process_once: self.sockets=[]
 0.5s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 0.7s -> None
 0.7s process_once(<irc.client.Reactor object>, 0.2)
 0.7s   process_once: self.sockets=[]
 0.7s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 0.9s -> None
 0.9s process_once(<irc.client.Reactor object>, 0.2)
 0.9s   process_once: self.sockets=[]
 0.9s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 1.1s -> None
 1.1s process_once(<irc.client.Reactor object>, 0.2)
 1.1s   process_once: self.sockets=[]
 1.1s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 1.3s -> None
 1.3s process_once(<irc.client.Reactor object>, 0.2)
 1.3s   process_once: self.sockets=[]
 1.3s   process_once: self.connections=[<irc.client.ServerConnection object>],
        self.connections[0].socket=None
 1.5s -> None

Any idea?

jaraco commented 8 years ago

My guess is Freenode is rejecting the connection based on authentication or other factors (failure to respond to certain messages, such as PING, perhaps). I know the lib works with Freenode, as pmxbot on freenode is built on this lib. If testbot.py doesn't provide an option for verbose logging, you'll need to add that to find out what messages are being sent, and that will almost certainly reveal the cause.

jleclanche commented 8 years ago

I just got around to this again and tested irccat.py. That one works fine. I don't know why the ircbot.py shipped with the library hangs, but it's probably something you'll want to fix as it's right now the main entry point to bot-like documentation for the lib.