Refresh Loop / Logged Out / Clearing Message Bus


(Rob Yurkowski) #1

I… I’m not even sure how to begin.

I’m running the latest version of Discourse using the web_only template – using external Redis and Postgres servers, and also fronted by a reverse proxy using haproxy.

Today, when I was trying to get haproxy to pass along the actual IP of the client, I used the ‘Force Browser Refresh’ button on the back-end for my profile. I have a sneaking suspicion I clicked it twice.

As a result, the page would load… and then refresh. And then refresh again. And refresh again. And on and on in a never-ending loop of pain.

Logging out (which I managed) interrupted the cycle, and I was able to browse anonymously, but then when I logged back in, the redirect loop was back.

So I URL-manipulated my way to the back-end page for my user and clicked the ‘logout user’ button, hoping that would fix things (NB: I have ‘logout on all devices’ disabled).

Nope.

Now whenever I log in, I get a popup that says that I’ve been logged out… and before I can do anything, the page refreshes, only to repeat. On the odd chance that I’m quick enough to click the ‘Refresh’ button on that modal, I’m logged out, redirected to my logout page… and then when I try to login again, it’s back.

So I did a bit of digging, and found out that the MessageBus was responsible. I also found a ton of messages under the /logout channel there, so I figured I’d clear out Redis and things would be solved. No dice – a FLUSHDB on both the database specified in DISCOURSE_REDIS_HOST and a FLUSHDB to the entire server itself both failed to solve the problem.

I’ve restarted Redis, restarted Sidekiq, rebuilt and restarted Discourse, and I’m still stuck in this Sisyphean nightmare. I don’t really know what I did, but I’m sorry, I promise.

I’m also at the limit of my troubleshooting ability here. I could dig more into MessageBus and figure out how it’s discharged, but I was hoping someone with a bit more knowledge of that code could give me a few tips on how best to get myself straight again!


(Jeff Atwood) #2

I am not a fan of this “force browser refresh” feature and think we should kill it. cc: @sam.


(Sam Saffron) #3

This is not really related to that issue, the button sends a single message,

This sounds like the message bus is never clearing, maybe redis is read only of something


(Rob Yurkowski) #4

Thanks, Sam. That was enough to go by.

I’d had an issue with Redis the other day where it was missing the overcommit_memory setting, so I’d temporarily disabled RDB dumps. I apparently missed changing the stop-writes-on-bgsave-error line (despite the fact that the documentation says it’s only enabled if there’s a single savepoint) when I did a kludgy quick fix – either that or the server never properly reloaded.

Changing that to no and force-reloading Redis has solved the problem. Bless you.