singlerider / lorenzotherobot

Twitch Chat bot written in Python
17 stars 9 forks source link

Socket Timeout when tried to connect... Once it's connected... I trigger a command, the socket disconnected before sending response back to chat. #61

Closed kyroskoh closed 8 years ago

kyroskoh commented 8 years ago

(venv) root@us3vps2:~/pokebot_pokemon# ./serve.py Connecting to group.tmi.twitch.tv:6667 Traceback (most recent call last): File "./serve.py", line 7, in Bot() File "/root/pokebot_pokemon/src/bot.py", line 45, in init self.IRC = IRC(config) File "/root/pokebot_pokemon/src/lib/irc.py", line 22, in init self.connect("whisper") File "/root/pokebot_pokemon/src/lib/irc.py", line 124, in connect self.connect_phases(sock, server, port, kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 136, in connect_phases sock.connect((server, port)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.timeout: timed out

(venv) root@us3vps2:~/pokebot_pokemon# ./serve.py Connecting to group.tmi.twitch.tv:6667 [12:08:44] [INFO] Sending Username pokemanbot [12:08:44] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:08:44] [INFO] Sending Nick pokemanbot Connection was lost Connecting to group.tmi.twitch.tv:6667 Traceback (most recent call last): File "./serve.py", line 7, in Bot() File "/root/pokebot_pokemon/src/bot.py", line 45, in init self.IRC = IRC(config) File "/root/pokebot_pokemon/src/lib/irc.py", line 22, in init self.connect("whisper") File "/root/pokebot_pokemon/src/lib/irc.py", line 124, in connect self.connect_phases(sock, server, port, kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 145, in connect_phases loginMsg = self.nextMessage(kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 32, in nextMessage self.connect(kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 124, in connect self.connect_phases(sock, server, port, kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 145, in connect_phases loginMsg = self.nextMessage(kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 32, in nextMessage self.connect(kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 124, in connect self.connect_phases(sock, server, port, kind) File "/root/pokebot_pokemon/src/lib/irc.py", line 136, in connect_phases sock.connect((server, port)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.timeout: timed out

(venv) root@us3vps2:~/pokebot_pokemon# ./serve.py Connecting to group.tmi.twitch.tv:6667 [12:08:44] [INFO] Sending Username pokemanbot [12:08:44] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:08:44] [INFO] Sending Nick pokemanbot Connection was lost Connecting to group.tmi.twitch.tv:6667 [12:03:02] [INFO] Sending Username pokemanbot [12:03:02] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:03:02] [INFO] Sending Nick pokemanbot [12:03:02] [INFO] Joining whisper server [12:03:02] [INFO] Joined channels. Connecting to irc.chat.twitch.tv:6667 [12:03:02] [INFO] Sending Username pokemanbot [12:03:02] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:03:02] [INFO] Sending Nick pokemanbot [12:03:02] [INFO] Joining channels #sgkyros,#hime_kk. [12:03:02] [INFO] Joined channels. ->* hime_kk #sgkyros !tallgrass 5 [12:03:17 #sgkyros] [BOT] Command is valid and not on cooldown. (!tallgrass) (hime_kk) [12:03:17 #sgkyros] BOT : A wild Geodude appeared! Connection was lost Connecting to irc.chat.twitch.tv:6667 [12:03:18] [INFO] Sending Username pokemanbot [12:03:18] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:03:18] [INFO] Sending Nick pokemanbot [12:03:18] [INFO] Joining channels #sgkyros,#hime_kk [12:03:18] [INFO] Joined channels. ->* charshubby #sgkyros oooh I see Connection was lost Connecting to irc.chat.twitch.tv:6667 [12:06:03] [INFO] Sending Username pokemanbot [12:06:03] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxxxxx [12:06:03] [INFO] Sending Nick pokemanbot [12:06:03] [INFO] Joining channels #sgkyros,#hime_kk [12:06:03] [INFO] Joined channels.

kyroskoh commented 8 years ago

Probably it is Twitch Chat Servers problem due to its round robin... I have temporary fixed it when keep on retrying randomly... Now have to figure out the server that is working... Could you help me to confirm it if it's Twitch's connection problem?

singlerider commented 8 years ago

It's Twitch's problem. Just keep retrying. It will connect. Once you get a connection, it's solid.

kyroskoh commented 8 years ago

Hello, when the bot get connected whenever the command is (valid) triggered such as !tallgrass [x] and !party, the connection was lost. When the command is on cooldown, it won't make the connection disconnected. And when I typed just !battle (where it is not valid return command), it won't disconnect the bot then I typed the 2 parameters with it such as !battle 1 username, it will disconnect. When I /w the bot, it is not returning the result to my whisper (I can see the result in the console). It used to work yesterday.

singlerider commented 8 years ago

Include a suspected code snippet reference in the next comment.