knrd1 / chatgpt

ChatGPT IRC bot
https://github.com/knrd1/chatgpt
MIT License
33 stars 7 forks source link

ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2393) #32

Closed ph818 closed 8 months ago

ph818 commented 8 months ago

I was able to get up and running, but I get the following traceback which I do not understand.

  File "/home/semitones/threepio-semitones/chatgpt/chatgpt.py", line 77, in <module>
    irc.send(bytes("JOIN " + ",".join(channels) + "\n", "UTF-8"))
  File "/usr/lib/python3.11/ssl.py", line 1210, in send
    return self._sslobj.write(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2393)

Here is the full context:

Connecting to: irc.libera.chat
Connected to: irc.libera.chat
:mercury.libera.chat NOTICE * :*** Checking Ident
:mercury.libera.chat NOTICE * :*** Looking up your hostname...

:mercury.libera.chat NOTICE * :*** Found your hostname: xxx.xxx.xxx.xxx.bc.googleusercontent.com

:mercury.libera.chat NOTICE * :*** No Ident response

:mercury.libera.chat NOTICE threepio :*** Notice -- SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance.

Traceback (most recent call last):
  File "/home/semitones/threepio-semitones/chatgpt/chatgpt.py", line 77, in <module>
    irc.send(bytes("JOIN " + ",".join(channels) + "\n", "UTF-8"))
  File "/usr/lib/python3.11/ssl.py", line 1210, in send
    return self._sslobj.write(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2393)

Looking at this part :mercury.libera.chat NOTICE threepio :*** Notice -- SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance. is that why SSL is failing?

When I put the password into chat.conf, I don't get the SSL anymore, instead I get this:

(openai+pyshorteners) semitones@bot-base:~/threepio-semitones/chatgpt$ python3 chatgpt.py 
Connecting to: irc.libera.chat
Connected to: irc.libera.chat
:lead.libera.chat NOTICE * :*** Checking Ident
:lead.libera.chat NOTICE * :*** Looking up your hostname...

:lead.libera.chat NOTICE * :*** Found your hostname: xxx.xxx.xxx.xxx.bc.googleusercontent.com

:lead.libera.chat NOTICE * :*** No Ident response

:lead.libera.chat NOTICE threepio :*** Notice -- SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance.

ERROR :Closing Link: xxx.xxx.xxx.xxx.bc.googleusercontent.com (SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance.)

Received ERROR from server. Reconnecting...
Connecting to: irc.libera.chat
Connected to: irc.libera.chat
:calcium.libera.chat NOTICE * :*** Checking Ident
:calcium.libera.chat NOTICE * :*** Looking up your hostname...

:calcium.libera.chat NOTICE * :*** Found your hostname: xxx.xxx.xxx.xxx.bc.googleusercontent.com

:calcium.libera.chat NOTICE * :*** No Ident response

:calcium.libera.chat NOTICE threepio :*** Notice -- SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance.
ERROR :Closing Link: xxx.xxx.xxx.xxx.bc.googleusercontent.com (SASL authentication to a NickServ account with a verified email address is required to connect from your current network. Please see https://libera.chat/guides/sasl for configuration assistance.)

Does knrd1/chatgpt support SASL or should I just try to avoid it for now?

knrd1 commented 8 months ago

Hey, thanks for your message, I just had a quick look at irc.libera.chat and your issues:

1) ChatGPT IRC Bot doesn't support SASL at this time.

2) I tried to connect to irc.libera.chat via irssi from multiple different test VPS around the world. Some of the VPS test servers connect immediately without issues. Other always throw the error message you posted. It's for both ports, 6667 and SSL 6697.

3) I also ran the ChatGPT IRC Bot form the same VPS servers, the results are the same: it's either connecting successfully or failing with the same message you have, depending on the IP address of test VPS.

4) I tested irssi and ChatGPT IRC Bot using irc.libera.chat:6667 or SSL irc.libera.chat:6697 - results are the same.


Clearly the problem is with some IP ranges... Apparently irc.libera.chat favours some networks and penalises others... for whatever reason. So for now the solution is to connect the bot from the IP ranges that are allowed to connect to irc.libera.chat without issues.

This won't be investigated as it's rather a server-side problem, not ChatGPT IRC Bot.