Moving posts returns 502 bad gateway

The following commit should improve the performance and reduce the number of 502 errors.


It helps a lot!


I’m still seeing these errors, I’m afraid :frowning:

1 Like

Yep, still appears from time to time.

502 errors on moving 5 messages.

5 posts in a PM? That’s weird. Is this a standard installation on Digital Ocean? Which kind of droplet?

I tired to move 5 message from thread of 26 messages to thread with 200+ messages. 502!
Then I tried to move 2 of 2 messages to another thread with 1000+ messages. 502!

I do have standard Digital Ocean installation.
4 vCPUs / 8 GB Memory / 160 GB Disk + 200 GB / LON1

Forum statistics
Last 7 Last 30 All Time
Topics 101 486 11.0k
Posts 10.8k 45.0k 1.3M
Users 45 212 4.7k
Active Users 1.9k 2.3k —
Likes 12.4k 50.9k 1.0M

@gerhard is this the expensive post topic number remapping work?

It could also be the updating of quotes that was added recently. There were no new reports of 502 errors until that was added. I’ll have a look. It’s probably time to move all the resource intensive work into a background job.


Status update!

2.4.0.beta8 was good in term of 502 moving errors.
2.4.0.beta9 is terrible. Every move attempts gives 502.

I feel like this is something we need to get sorted, we have some customer complaints about poor performance here as well.

@kris.kotlarek can you bump this to the front of your list this week to have a quick look.


Great to see, as we were having a lot of trouble with this issue.

Will there by any way to change the timeout settings down the road? I notice that most of my 502 errors come when trying to move content out of a highly-populated topic.

Thanks all for addressing this problem.

1 Like

Following up on this, no 502 errors since our latest update. Not sure what changed, but appreciative nonetheless.



Well, not to be that guy, but…it’s back.

Scenario: user posts a video mistakenly in our “Pictures only” topic which has 5100+ posts containing images. I attempt to move that video to our “Videos only” topic, but I have started receiving the “502 error” message again.

This also happened a few days ago when trying to move some images from another topic into our “Pictures only” topic.

Could it have to do with the size of the originating topic at all? Does Discourse need to index or read the entire topic before moving the offending post to another location? It does seem to be the one originating topic that gives us the most trouble when we try to make a move.

We’re hosted with AWS if that matters.

Thanks for any guidance.



We have same issue about 2 weeks. It’s possible to rebuild with stable version?


I no longer know what version was the last one where this was not an issue, or whether or not it’s the size of our topic that is causing the issue.

I solved this problem. Our server used only ~2gb memory. But we have 16gb memory on vps. When try to move post I see postgresql use a lot of cpu but memory usage doesn’t change. After I changed db_shared_buffers parameter on container config file and rebuild app 502 problem solved.


We will try your method and report back. Appreciated!


This issue has returned — 502 when moving just 5 posts to an existing topic.

Trying to move 5 posts starting from this one .

The source topic has 7k+ messages in it.


I can confirm that on the latest there is this problem (even though there is no load on the server)

In my case target topic has 7k replies and I’m unable to move single post from topic without replies. 502 error.