sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
291 stars 27 forks source link

Websocket Mode Error #180

Closed remlap closed 5 years ago

remlap commented 5 years ago

discord - Login error: Failed to switch to websocket mode

It just loops then trying to reconnect.

sm00th commented 5 years ago

Could you provide a debug log? See "Debugging" section in README and remember to delete the password/token from the log.

remlap commented 5 years ago

This only begun when switching to Ubuntu 18.10

`[10:53:15] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization: removed

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 10:53:15 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: removed; expires=Thu, 14-Nov-19 10:53:15 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 10:53:45 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 4798eeeccf496a85-LHR

Finishing HTTP request with status: 200 OK [10:53:15] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}

DEBUG util: requesting to fetch a URL DEBUG dnsquery: Performing DNS lookup for 192.168.1.1 DEBUG dnsquery: IP resolved for 192.168.1.1 DEBUG proxy: Attempting connection to 192.168.1.1 DEBUG proxy: Connecting to 192.168.1.1:38400 with no proxy DEBUG proxy: Connection in progress DEBUG proxy: Connecting to 192.168.1.1:38400. DEBUG proxy: Connected to 192.168.1.1:38400. DEBUG util: request constructed DEBUG util: Response headers: 'HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: 3489 Date: Wed, 14 Nov 2018 10:53:31 GMT

DEBUG util: parsed 3489 DEBUG util: requesting to fetch a URL DEBUG dnsquery: Performing DNS lookup for 192.168.1.1 DEBUG dnsquery: Performing DNS lookup for 192.168.1.1 DEBUG dnsquery: IP resolved for 192.168.1.1 DEBUG proxy: Attempting connection to 192.168.1.1 DEBUG proxy: Connecting to 192.168.1.1:38400 with no proxy DEBUG proxy: Connection in progress DEBUG dnsquery: IP resolved for 192.168.1.1 DEBUG proxy: Attempting connection to 192.168.1.1 DEBUG proxy: Connecting to 192.168.1.1:38400 with no proxy DEBUG proxy: Connection in progress DEBUG proxy: Connecting to 192.168.1.1:38400. DEBUG proxy: Connected to 192.168.1.1:38400. DEBUG util: request constructed DEBUG proxy: Connecting to 192.168.1.1:38400. DEBUG proxy: Connected to 192.168.1.1:38400. DEBUG upnp: Local IP: 192.168.1.77 DEBUG util: Response headers: 'HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: 391 Date: Wed, 14 Nov 2018 10:53:31 GMT

DEBUG util: parsed 391 DEBUG upnp: NAT Returned IP: removed DEBUG util: Writing file prefs.xml to directory /var/lib/bitlbee//purple DEBUG util: Writing file /var/lib/bitlbee//purple/prefs.xml [10:53:20] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization: removed

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 10:53:20 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: removed; expires=Thu, 14-Nov-19 10:53:20 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 10:53:50 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 4798ef0d9c436b4f-LHR

Finishing HTTP request with status: 200 OK [10:53:20] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}

[10:53:36] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization: removed

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 10:53:36 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: removed; expires=Thu, 14-Nov-19 10:53:36 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 10:54:06 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 4798ef6d0a876aaf-LHR

Finishing HTTP request with status: 200 OK [10:53:36] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}

[10:54:21] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization: removed

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 10:54:21 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: removed; expires=Thu, 14-Nov-19 10:54:21 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 10:54:51 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 4798f087df9d6b5b-LHR

Finishing HTTP request with status: 200 OK [10:54:21] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}`

sm00th commented 5 years ago

8eee0b7 adds some debuginfo that would hopefully help us debug what is going on there. Can you please try with that commit and post the debug log?

remlap commented 5 years ago

About to send HTTP request: POST /o/oauth2/token HTTP/1.0 Host: accounts.google.com Content-Type: application/x-www-form-urlencoded Content-Length: 196

client_id= [15:55:54] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization:

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 15:55:54 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: __cfduid=; expires=Thu, 14-Nov-19 15:55:54 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 15:56:24 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 479aaa4169b46a31-LHR

Finishing HTTP request with status: 200 OK [15:55:54] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}

HTTP response headers: HTTP/1.0 200 OK Content-Type: application/json; charset=utf-8 Vary: X-Origin Vary: Referer Date: Wed, 14 Nov 2018 15:55:54 GMT Server: ESF Cache-Control: private X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35" Accept-Ranges: none Vary: Origin,Accept-Encoding

Finishing HTTP request with status: 200 OK { "access_token": "", "expires_in": 3600, "scope": "https://www.googleapis.com/auth/googletalk", "token_type": "Bearer" } Extracted rtoken=(null) [15:55:59] >>> ((null)) discord_http_get 217 About to send HTTP request: GET /api/gateway HTTP/1.1 Host: discordapp.com User-Agent: Bitlbee-Discord Content-Type: application/json authorization:

HTTP response headers: HTTP/1.1 200 OK Date: Wed, 14 Nov 2018 15:55:59 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Set-Cookie: __cfduid=; expires=Thu, 14-Nov-19 15:55:59 GMT; path=/; domain=.discordapp.com; HttpOnly Strict-Transport-Security: max-age=31536000; includeSubDomains Via: 1.1 google Alt-Svc: clear CF-Cache-Status: HIT Expires: Wed, 14 Nov 2018 15:56:29 GMT Cache-Control: public, max-age=30 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare CF-RAY: 479aaa623afd6a19-LHR

Finishing HTTP request with status: 200 OK [15:55:59] <<< ((null)) discord_http_gateway_cb [200] 35 {"url": "wss://gateway.discord.gg"}

sm00th commented 5 years ago

So I was able to kinda reproduce this on a ubuntu 18.10 vm. I say "kinda" because it doesn't loop endlessly but succeeds after 1-2 retries. The problem I am seeing is ssl_read returning SSL_AGAIN was never an issue before, I've added it's handling in 1007322 and 2aec1fc, so this theoretically should fix the issue you are seing.

remlap commented 5 years ago

Working great, thank you!