Closed zneix closed 3 years ago
Side note: This rate-limit has been documented on Twitch's documentation I linked for quite a long time now (at least a year or so, if not way longer), we just never followed that and the rate-limit was entirely cosmetic. Seems like an hour or so ago Twitch actually deployed a fix that enforces that rate-limit into effect.
@zneix
Thanks for documenting this zneix
@zneix from testing Chatsen it appears to handle JOINs correctly. Able to join more than 20 channels at once. Might wanna update that section.
As a reference:
Note: This information just comes from my own testing, interpretation of Twitch docs and some comments by Staff. All of this was tested a few months ago as well.
- PART is also ratelimited (ON THE SAME RATE AS JOIN) [...]
I am not able to reproduce this right now. I'm able to PART more than 35 channels in a single PART command and the connection stayed active. @zneix was also able to part 100+ channels in a short amount of time during testing.
- Ratelimit is per-IP and not per connection, [...]
This doesn't seem correct anymore as of 10 hours ago. The current docs state user based and my testing (as of today) confirms this. With two unverified bots I was able to join 15 channels each (30 total) instantly from the same IP.
It being user based would also make more sense due to the higher limit for verified bots. I was able to join over 500 channels in 10 seconds on my verified bot and at the same time 15 on my unverified bot without being kicked on either connection.
thanks for the information
twitch 😡
I had the same issue. I closed my tabs, til I have ~18 open and it stopped with the disconnecting/reconnecting.
It being user based would also make more sense due to the higher limit for verified bots. I was able to join over 500 channels in 10 seconds on my verified bot and at the same time 15 on my unverified bot without being kicked on either connection.
I Tried to join 2 lots of 18 channels, 1 instance on my pc and 1 instance on my server (in a different country). This failed, however closing 1 instance of chatterino, allowing the other to connect and then reopening the 2nd instance worked. This backing up rate limit based on user.
- PART is also ratelimited (ON THE SAME RATE AS JOIN) [...]
I am not able to reproduce this right now. I'm able to PART more than 35 channels in a single PART command and the connection stayed active. @zneix was also able to part 100+ channels in a short amount of time during testing.
- Ratelimit is per-IP and not per connection, [...]
This doesn't seem correct anymore as of 10 hours ago. The current docs state user based and my testing (as of today) confirms this. With two unverified bots I was able to join 15 channels each (30 total) instantly from the same IP.
It being user based would also make more sense due to the higher limit for verified bots. I was able to join over 500 channels in 10 seconds on my verified bot and at the same time 15 on my unverified bot without being kicked on either connection.
Yeah it's possible either my testing wasn't correct or the behavior has changed.
For the per-ip test, I had just used the same account on my current home computer and on my VPS and it worked just fine when joining 20 channels at once but there might have been something else at play (different application and token perhaps, even for the same account)
I'll be trying out these two points again as soon as I have time for that and post back if I find anything new, thanks for sharing!
I have just done a bit more testing in regards to token and applications:
With no combination of token and application was I able to go over the 20 limit. These test where all done from the same machine though. I have not tested any other factors like IP or IRC vs WS yet.
would the simple solution to make it join channels in groups of less than 20? so lets say you have 54 channels open, you join in groups of like 15, you do that once every 10 seconds until you have joined all the channels. unless there is something that i dont entirely understand about how they are limiting the join rate i feel its fairly simple.
would the simple solution to make it join channels in groups of less than 20? so lets say you have 54 channels open, you join in groups of like 15, you do that once every 10 seconds until you have joined all the channels. unless there is something that i dont entirely understand about how they are limiting the join rate i feel its fairly simple.
Correct, we're trying to add some sort of "queue" for JOIN messages working pretty much as you've described. The catch here is that we can't be sure if user isn't trying to JOIN a channel from another Chatterino instance or another application (as @cineafx described it in his testing). Joining should be most likely done in "groups" of less than 20 channels, or else trying to open a channel in any other application could get all connections killed. That happens because the limit is tied to the account, not application / token / device / etc.
A little update on the issue: A little "bandaid" in #3112 has been merged in, making Chatterino not JOIN channels on write connection.
For background, Chatterino uses 2 connections to twitch chat: "read" for listening to incoming messages and "write" for sending messages. While looking for a fix to this we've noticed that JOINing on write is unnecessary. It will make developing actual fix easier.
It will most likely have to be done, so connecting to all chats after starting Chatterino will need to be done in groups on 15-20 channels per 10 seconds. Same will have to be done on reconnections to chat after changing accounts / regaining lost internet connection. That's unfortunately necessary for us to do or else connection would be killed and you'll be stuck in the reconnection loop forever.
Thanks zneix for the explanation, workaround and pin!
I've been thinking about the explicit mention of per user in the docs, So I did some testing.
Testing with the following setup:
Close both Chatterino instances and re-open them both at the same time. Immediately post a test message on the shared channel to check if all clients are still connected.
Result: Success. None of the 3 clients get disconnected.
So splitting the joins between multiple sub accounts would be the fastest way to get read access to every channel, with the main account(s) only joining later at a slower pace or "just in time" when actually interacting with the channel. It's especially useful in situations with a spotty internet connection since it reduces the downtime to a minimum.
HOWEVER, and this is a big however, this almost certainly violates the spirit (maybe even the explicitly written part) of the Twitch terms and guidelines. As such, I'm not really recommending this approach.
Testing with the following setup:
main account on an irc client as control if disconnects would affect a different account with a different token on a different client
Alt account A on Chatterino portable instance A, opening 18 random channels and one shared channel.
Alt account B on Chatterino portable instance B, opening another 18 random channels and the same shared channel.
This requires the user to have alt accounts just to see more channels on first join. Doesn't sound like a solution to me.
Testing with the following setup:
- main account on an irc client as control if disconnects would affect a different account with a different token on a different client
- Alt account A on Chatterino portable instance A, opening 18 random channels and one shared channel.
- Alt account B on Chatterino portable instance B, opening another 18 random channels and the same shared channel.
This requires the user to have alt accounts just to see more channels on first join. Doesn't sound like a solution to me.
How about upon when an user clicking on a tab or that tab get focused upon opening Chatterino, that channel now get prioritized in the queue and then Chatterino will load that tab first?
I'm going to make a note here: As of sometime earlier the disconnections have been.... bandaged..? internally by twitch (I assume). Now instead of spam disconnecting you, you only connect to the first(?) 19 channels (As indicated by the fact that message history only loads in those 19 channels.)
I don't know what the extent of the change or the reasoning, but this might indicate other upcoming changes on the subject at hand.
or maybe i'm wrong idk i'm not a scientist
Will adding a delay between channel joining solve it? Like slow loading where only one channel is joined per minute? If so is it possible to do with a script or setting without waiting for an update?
@Cragsand a fix for this issue is coming in hot in #3115 so just be patient, it's gonna be merged in even today in like an hour or less.
I wouldn't advise using a script hacking around window-layout.json
while Chatterino is running due to how our settings libary handles reading and saving setting files and you could mess your layout up.
Ok, second to last update everyone! As you can see, #3115 has been merged in. That means there's a new nightly release which has the fix.
Chatterino release v2.3.4 will be out next morning, pushed to beta and if all goes well it'll be pushed to stable releases right afterwards. I'll make a final reply when the beta for v2.3.4 is out. If you want to use it, make sure to enable the below tickbox in settings:
2.3.4 beta is out, it can be obtained as shown in the above screenshot. 🙂
UPDATE
This issue is now resolved and the fix is available, see my comment below: https://github.com/Chatterino/chatterino2/issues/3107#issuecomment-892999489
Why does Chatterino keep disconnecting?
tl;dr for nerds: Chatterino exceeds 20 JOIN / 10s ratelimit, causing Twitch to terminate connection instantly.
As stated in Twitch's documentation, attempting to JOIN more than 20 channels per 10 seconds is not allowed. That results in Twitch immidiatelly shutting your connection down.
What happens, Chatterino tries to JOIN all the channels at once without any throttling. If you have more than 20 channels, Twitch will disconnect Chatterino. Chatterino will try to reconnect, repeat indefinietly.
What can I do for now?
Until a fix is available you have a few choices:
If you're going to go with 1. - before doing so, better copy your window layout, so you may restore it later. It's a file in Chatterino's folder in
Settings/window-layout.json
. Copy it somewhere first, then close all channels until you reach 20 or less. When a fixed version of Chatterino releases, simply replace the newwindow-layout.json
with the one you backed up to restore all closed tabs.Sorry for the sudden issue, I'll try to work on it ASAP. Thanks for understanding.