שגיאה 502 Gateway שגויה לאחר עדכון לגרסה האחרונה

After updating to the latest version of Discourse we now have a strange issue with ngix posting error 502.

Some users get Error 502 when posting, some don’t. Some profiles get 502, some don’t.

CPU usage is around 10 to 25%, RAM usage is about 20% as well.

I tried disabling our 5 plugins, same result.

What logs do I look at to find out what is producing these 502 errors?

Looking in I /var/log/nginx/error.log I seem to randomly get a lot of these, which produces the 502 I assume.

Its just timing out or what?

2025/04/29 18:11:50 [error] 617#617: *419 upstream prematurely closed connection while reading response header from upstream, client: <IP>, server: _, request: "POST /posts HTTP/2.0", upstream: "http://127.0.0.1:3000/posts", host: "forum.domain.com", referrer: "https://forum.domain.com/" 

What was the version prior to the update?

Really old, like a year old or more. Is there a log somewhere I can see what I upgraded from?

Also getting some of these

*2 connect() failed (111: Connection refused) while connecting to upstream,
...
upstream: "http://127.0.0.1:3000/message-bus/92fd28cbf742...

It seems random, suddenly everything is fast and I can post again, and then it goes slow and 502’s start popping up again.

מסתכלים בתוך יומן ה- postgres/current

2025-04-29 18:48:24.709 UTC [1746] discourse@discourse LOG:  זמן ריצה: 606789.911 מ״ל  ביצוע בלי שם: SELECT COUNT(*) FROM "posts" WHERE "posts"."deleted_at" IS NULL

time: 606789.911 מ״ל

יש לנו הרבה פוסטים, מעט משתמשים.. מדוע זה לוקח 600k מ״ל על זה?

Might it be problems with indexing or such, that makes the queries slow?

I selected the discourse table in postgres and did a REINDEX DATABASE discourse; in the hope of that making things faster.

I assume it will take a very long time.

Did you follow the advice in PostgreSQL 15 update? You might also vaccuum the database.

אני לא, יש לי את התיקייה postgres_data_old (אם כי באותה תקייה שונה מהפוסט ההוא).

אבל אז הפוסט אומר;

“אם אתה מריץ הגדרה עם מכולת נתונים ייעודית” which אני מניח פירושו שפורצער רץ במכולת Docker ייעודית?

השלנו רצות באותה מופעלת כמו הפורום. אז לא בטוח איך להמשיך משם כי אין נראה שיש תנאי “אם לא”?

האם קיומו של התיקייה אומר שההמרה הייתה בסדר או שאולי צריך משהו אחר?"}}the{

אתה יכול לבדוק את גרסת ה-Postgres ב-/var/discourse/shared/standalone/postgres_data/PG_VERSION – אם ביצעת שדרוג משורת פקודה, ייתכן שזה ביצע את השדרוג ואתה לא שמת לב (אבל היית צריך להפעיל את הבנייה מחדש פעמיים). אם שידרגת מواجهة האינטרנט, סביר להניח שכדאי לך לעשות את הבנייה מחדש משורת הפקודה אם מערכת ההפעלה שלך ו-Docker הם גרסאות עדכניות.

Verson is 15.

It seems things are a lot better after I ran the vaccuum command.

Posting works fine and seems to be fast, but when admin try clicking user profiles, go into their profiles, it still 502’s, time out it seems like?

Is there something I can do to speed up that portion of the db?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.