bug: Twitch connection fails with "connection failed EOF"
🌧 Describe the problem
Following https://github.com/42wim/matterbridge/issues/2037 commit https://github.com/lrstanley/girc/commit/82409175c90805b876fef8a5be034d6a1c698ab8 causes matterbridge not connect to twitch.tv on irc protocol properly.
Using matterbridge-1.26.0-linux-64bit and this config
[irc.tv]
Password="mytokenwasreplacedofc"
Nick="Somenick"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
RemoteNickFormat="<{NICK}> "
Charset="utf-8"
I get this error:
time="2023-04-04T11:26:18Z" level=error msg="disconnect: error: EOF" prefix=irc time="2023-04-04T11:26:18Z" level=fatal msg="Starting gateway failed: Bridge irc.tv failed to start: connection failed EOF" prefix=main
Downgrading to matterbridge-1.25.2-linux-64bit does not produce the same error. This only difference between those two versions is the commit mentioned above. The matterbridge folks advised me how to compile without this commit: https://github.com/42wim/matterbridge/issues/2037#issuecomment-1499700252 and it worked as expected.
The same matterbridge connects to irc.libera.chat without problems, so it seems something twitch specific.
Here you can see a successful join to irc.libera.chat and then starts the join to twitch. Matterbridge with --debug option:
time="2023-04-06T21:56:28Z" level=debug msg=""CLIENT_CONNECTED irc.libera.chat:6667"" func=handleOther file="bridge/irc/handlers.go:170" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="Connection succeeded" func=Connect file="bridge/irc/irc.go:107" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="irc.yl: joining #your-land-web (ID: #your-land-webirc.yl)" func=joinChannels file="bridge/bridge.go:77" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg=""@time=2023-04-06T21:56:26.913Z :YL MODE YL +iw"" func=handleOther file="bridge/irc/handlers.go:170" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="irc.yl: joining #your-land-chat (ID: #your-land-chatirc.yl)" func=joinChannels file="bridge/bridge.go:77" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="irc.yl: joining #your-flight-chat (ID: #your-flight-chatirc.yl)" func=joinChannels file="bridge/bridge.go:77" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="irc.yl: joining #your-land-dev (ID: #your-land-devirc.yl)" func=joinChannels file="bridge/bridge.go:77" prefix=irc
time="2023-04-06T21:56:32Z" level=info msg="Starting bridge: irc.tv " func=Start file="gateway/router.go:75" prefix=router
time="2023-04-06T21:56:32Z" level=info msg="Connecting irc.chat.twitch.tv:6697" func=Connect file="bridge/irc/irc.go:81" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="setting pingdelay to 1m0s" func=getClient file="bridge/irc/irc.go:306" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="handle girc.Event{Source:(*girc.Source)(0xc000c2e450), Tags:girc.Tags{"time":"2023-04-06T21:56:32.231Z"}, Timestamp:time.Date(2023, time.April, 6, 21, 56, 32, 231000000, time.Local), Command:"JOIN", Params:[]string{"#your-land-web", "*", "YL"}, Sensitive:false, Echo:false}" func=handleJoinPart file="bridge/irc/handlers.go:117" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="333: Topic set by Alias [~Alias@user/alias] [2022-04-04 21:48:03 +0000 UTC]" func=handleTopicWhoTime file="bridge/irc/handlers.go:264" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="handle girc.Event{Source:(*girc.Source)(0xc000a171a0), Tags:girc.Tags{"time":"2023-04-06T21:56:32.232Z"}, Timestamp:time.Date(2023, time.April, 6, 21, 56, 32, 232000000, time.Local), Command:"JOIN", Params:[]string{"#your-land-chat", "*", "YL"}, Sensitive:false, Echo:false}" func=handleJoinPart file="bridge/irc/handlers.go:117" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="handle girc.Event{Source:(*girc.Source)(0xc000b40690), Tags:girc.Tags{"time":"2023-04-06T21:56:32.233Z"}, Timestamp:time.Date(2023, time.April, 6, 21, 56, 32, 233000000, time.Local), Command:"JOIN", Params:[]string{"#your-flight-chat", "*", "YL"}, Sensitive:false, Echo:false}" func=handleJoinPart file="bridge/irc/handlers.go:117" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg="handle girc.Event{Source:(*girc.Source)(0xc000b40f60), Tags:girc.Tags{"time":"2023-04-06T21:56:32.233Z"}, Timestamp:time.Date(2023, time.April, 6, 21, 56, 32, 233000000, time.Local), Command:"JOIN", Params:[]string{"#your-land-dev", "*", "YL"}, Sensitive:false, Echo:false}" func=handleJoinPart file="bridge/irc/handlers.go:117" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg=""CLIENT_INIT irc.chat.twitch.tv:6697"" func=handleOther file="bridge/irc/handlers.go:170" prefix=irc
time="2023-04-06T21:56:32Z" level=debug msg=""CLIENT_DISCONNECTED irc.chat.twitch.tv:6697"" func=handleOther file="bridge/irc/handlers.go:170" prefix=irc
time="2023-04-06T21:56:32Z" level=error msg="disconnect: error: EOF" func=doConnect file="bridge/irc/irc.go:194" prefix=irc
time="2023-04-06T21:56:32Z" level=fatal msg="Starting gateway failed: Bridge irc.tv failed to start: connection failed EOF" func=main file="matterbridge.go:66" prefix=main
This is the same log as in https://github.com/42wim/matterbridge/issues/2037#issuecomment-1499673427
⛅ Expected behavior
Connection to twitch.tv successful
🔄 Minimal reproduction
Run matterbridge 1.26.0 with the config mentioned above
💠 Version: girc
82409175c90805b876fef8a5be034d6a1c698ab8
🖥 Version: Operating system
linux/debian
⚙ Additional context
Workaround available: Downgrade to matterbridge-1.25.2-linux-64bit: version: 1.25.2 https://github.com/42wim/matterbridge/commit/20f841c5133d38dd9d0275b3f303215c18e3225f or removal of commit https://github.com/lrstanley/girc/commit/82409175c90805b876fef8a5be034d6a1c698ab8
Not urgent
Selfcontrolled, we can do all kinds of tests with it
Touches #54
Blocks https://github.com/42wim/matterbridge/issues/2037
For my reference 4114
🤝 Requirements
- [X] I believe the problem I'm facing is a bug, and is not intended behavior. Post here if you're not sure.
- [X] I have confirmed that someone else has not submitted a similar bug report.
interesting. I'd say this bug is pretty specific to Twitch's IRC implementation. the solution may be to implement an EarlyPing configuration directive.