Users who open too many Discourse pages in tabs get rate limited

AI-generated summary

The discussion addresses the user experience issue where opening multiple Discourse tabs triggers rate limits without clear feedback. j127 reports being locked out after opening many tabs and suggests UI improvements, such as explicit error messages advising users to close tabs or automatic pausing of background tabs when rate-limited. They later provided a detailed technical analysis (4) arguing that the message bus retries too aggressively (every 15 seconds) after a 429 error, even for hidden tabs, causing a

I’m not sure if there’s an easy way to fix this, but I just did it to myself.

If a user opens too many tabs of a Discourse site, they will get rate limited without an explanation.

It took me a few minutes to figure out, and after I figured it out, I checked the logs and can see that there’s a user in Europe who is getting rate limited from the same problem at the moment, probably not knowing why.

Would it be possible to make the UI check for a rate limiting message? And then if that tab is getting rate limited, it could show a message saying, “Please close some of your forum tabs because that’s why you’re getting rate limited.” Otherwise, there’s no indication about why the site doesn’t work.

Another idea is to add a line to the message something like this:

Slow down, you're making too many requests.
Please retry again in 5 seconds.
Error code: user_10_secs_limit.

If you have the forum open in many browser tabs open at once, close the tabs and the site will work again.

Edit: another idea is that if the frontend gets a rate-limiting message, that tab could print a message to the screen that it’s inactive, and then stop pinging the backend with that tab.

1 Like

I didn’t check, but I think that message has been that way for a decade. It’s always made sense to me that opening a bunch of tabs would be making a bunch of requests. I guess just HAVING a bunch open could also have the same effect and that could be confusing.

You can customize the text if you want to change it on your forum.

1 Like

How many tabs are we talking about here? usually idle tabs aren’t really doing a whole lot… the bigger issue tends to be the rate of which the tabs are opened.

The most common scenario in my experience is someone has 20 notifications and rapidly opens each one in a new tab. Towards the end of all those opens you’re likely to hit Slow down, you're making too many requests which is the correct error… you did too much too quickly. Usually by the time you reach one of those tabs you can refresh the page and be fine.

I see it regularly when I open tabs in the background too quickly, but it took me 15 minutes to figure out why I was getting rate limited after opening a huge number of them slowly and forgetting about them for a while.

I asked Claude to look at it and it said:

…normally a hidden tab polls once a minute, so 80 tabs is well under the limits. Once something bunches the polls together and one gets a 429, each tab retries every 15 seconds, four times faster than normal. 80 tabs retrying every 15 seconds is about 53 requests per 10 seconds, over the limit of 50. Discourse also counts the rejected requests, so the count never drops. Above about 75 tabs it keeps itself going until tabs are closed.

As soon as I rebooted the server, every browser tab apparently reconnected at the same time.

Claude said that

Hidden tabs poll 4 times faster after a 429, which can lock a user out of the site.

After a poll gets a 429, message-bus.js waits max(Retry-After, 15 s) before polling again, even in a hidden tab (the rateLimited branch of the complete handler). A hidden tab normally polls every backgroundCallbackInterval, which is 60 s in Discourse, so a 429 makes background tabs poll four times as often as when things are fine. With many tabs open, those retries alone keep the user over Discourse’s per-user limit (max_reqs_per_ip_per_minute, 200 by default): four polls a minute per tab passes 200 at about 50 tabs. The limiter is created with aggressive: true, so rejected requests count too and the block never expires. Every page load gets “Slow down, you’re making too many requests” until the user closes tabs. Changing network doesn’t help, because the limit is per user.

The cross-tab brake (hiddenTabShouldWait, a 1.5 s spacing through localStorage) also didn’t space hidden tabs out.

Suggested fix: when rate limited, wait max(Retry-After, normal interval for this tab), where the normal interval is callbackInterval when long polling and backgroundCallbackInterval otherwise. Add random jitter so tabs rejected together don’t retry together, and ideally back off on repeated 429s. Visible tabs are unchanged, since their interval is shorter than any Retry-After.

I don’t know how prevalent the problem is, but it might be worth looking at.

1 Like

Sorry I posted that reply before I saw your message. I had the composer window filling the page and was going back and forth between Claude for a while.

I wasn’t doing anything with my forum when it happened. The tabs were sitting in another browser window in the background, but something must have triggered a burst, and then once they got rate limited, that triggered more connections. Then when I rebooted, they probably all connected at the same time.

I’m not sure exactly what happened. Claude’s description above probably explains it better.

It probably isn’t a common problem.

A message in the tab that got the 429 would have saved me the same 15 minutes. In my case the tab did not show the error at all — it just sat with a spinner, so the only conclusion available was “this forum is broken”, not “I have too many tabs”.

The trigger for me was restoring a session with 15 to 20 forum tabs after a laptop sleep, all pointing at different Discourse sites. One of them stayed stuck even after a hard reload, which made it look site-specific rather than client-side.

If the tab can recognize the 429, I would also expect it to stop the message bus polling entirely until the tab becomes visible again. Retrying while hidden is what turns a few seconds of limit into being locked out.

I am surprised you were rate-limited for using different forums. :eyes: I am interested in hearing more: did the forums have something in common?

Actually, my forum behaves the same way.

Because clicking through new threads one by one and then returning to the list page to click the next one is tedious,

I right-click to open all new threads from the current day in new tabs, then switch between tabs to browse them one by one.

However, when opening the seventh thread, I might encounter a prompt saying “Please try again in 5 seconds.”

Have you thought about installing the “next topic” theme component?

Or using the keyboard shortcut?

Thanks for the suggestion, but it seems this requires waiting for the page to load every time a topic is switched.

I prefer right-clicking in the list view to open all links at once. This way, after browsing the previous topic, I can simply switch tabs without having to watch the loading page or wait for it to load.

But I’ll go ahead and install it to give it a try, thanks for the heads-up.

This[1] is how I use Discourse (and other websites) too.

Usually it doesn’t give issues, but I sometimes hit the limit. That sometimes happens when new plugins are installed that do more requests on page-load.
I don’t think the polling after the initial load is the main issue here, it’s the many requests done on initial load.

If you experience this a lot, it could be worth it to check if you’re running any (inefficient) custom plugins?


  1. OK, I middle click, but the idea is the same ↩︎

1 Like

That’s not true, the component uses the Ember router and doesn’t require a full page reload.

It simply pulls down the new data for the next topic and displays it (essentially).

hmmm … that hasn’t been touched for a very long time, I’ll be shocked if it still works out of the box

(it doesn’t - needs an update)

2 Likes

It seems you’re right. I just tested opening fifteen topics without any issues.

It’s possible that a previously installed plugin was causing the excessive requests.

1 Like