Moving posts returns 502 bad gateway

I’m trying to move ~100 posts to an existing topic.

After a delay of about 10 seconds, it says there was an error when moving posts in a green alert area:

No new entries in /logs

No useful information in console either:

What can be wrong and where to look for the error?

2 Likes

Yeah, what this probably means is that you tried to get Discourse to do so much work it had to time out the web worker (which happens after 30 seconds)

We should fix the underlying issue here, moving 100 posts really should not take that long and we can defer a bunch of the work.


Marking this as a performance #bug

4 Likes

For now, the work-around would be to move by small portions?

3 Likes

Yes, absolutely. Your server is stretched anyway from what I can tell.

I’hve just got this error 502 when try to move posts fro one thread to another.

It’s quite repetitive :frowning:

1 Like

How many were you moving?

happens several times in our case recently, for moving a single post to a new topic.

I tried several sets from hundreds to tens them single post!
I can’t find the reason why it doesn’t work sometimes and works just fine in another

Updated to 2.4.0.beta4 (cb8fa46970) but still experience 502 error on moving 1/5/10/50 messages.
It brakes administration routine so I can’t tidy up some treads.

Suffers.

Any logs/stat/settings would help?

@gerhard is this similar to the other reported issue by @Pad_Pors ?

2 Likes

I’m seeing the same thing. Could not find anything relevant in the logs, other than this in /logs:

Error: No Reason Phrase
Url: https://.no/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js

Let me know if there is a way to debug this in a better way.

I fixed an error that could appear when moving posts into an existing topic which was split in the past. Does this fix the problem you are encountering?


Are you sure that it happened when moving to a new topic? If so, then that’s a different error than the one I fixed and noticed in our logs.

5 Likes

Unfortunately, I’m still getting 502s with the fix:

Is there an error in /logs? How many posts are you moving? Are you moving the first post of a topic? Are you moving to a new or an existing topic? Is anything out of the ordinary (like whispers, deleted posts or previously split topics) involved?

yes, (before a recent update) we have faced the problem of 502 bad gateway while trying to change replies into a new topic (it did happen randomly and not always).

I’ll report if this still happens.

1 Like

I’m struggling to find a pattern, unfortunately. it fails when moving one or many posts. Though, I have a hunch it fails most often when moving between two larger topics, which I have a lot of. Many have been split several times. I’ve never used whispers but there are lots of deleted posts in most topics. No smoking-gun errors in /logs :frowning:

edit: I think it started after upgrading to beta5.

1 Like

Hi there,

on https://community.hiveeyes.org/, we recently experienced the same thing when moving posts between topics. While we haven’t investigated further,

If that might help: It was just a single post [1] we wanted to move from a non-public topic into a public one which raised this error. After failing on that, we replicated the post manually.

With kind regards,
Andreas.

[1] Pycom Firmware Release 1.20.1 - Firmwareschmiede / Firmware development - Hiveeyes

1 Like

Okay, so the error 500 should be fixed on latest and I just commited another fix so that the actual error appears in logs in case there’s another bug in there.

If you get an error 502 then the moving takes too long and times out. I made lots of changes over the last couple of months to move more metadata when moving posts. I tried to optimized it, but it highly depends on the amount of data and might still be too resource intensive for some server to do all the work in under 30 seconds.
The solution will be to refactor this one more time and store information about moved posts permanently in the database (instead of a temp table) and do all the heavy lifting in a background job.

4 Likes

This seems right as it does take a long time for the request to 502 :slight_smile: