502 bad gateway on specific searches

(I’ve read this thread, but it didn’t seem to help)

We recently updated our site to a more recent version of docker + discourse, and several users reported general site slowdown (I suspect this has to do more with disk space than the site itself). Something we did notice, however, is that now specific searches are giving us a 502 bad gateway (this seems to be category-independent). We also upgraded our postgres install as part of the rebuild process.

As with the linked thread, it seems that the searches are timing out with zero hits (the failing searches are things like “abcd” or similar nonsense).

Two things:

  • It was mentioned this could be fixed with a “Postgres statistics rebuild”. I googled this, but was having difficulty determining what actual actionable steps we could take to achieve this. I would really prefer an option that avoids reinstalling from scratch + restoring backup.

  • Can I submit this as a bug report/feature request? I think having a more informative error than 502 would be a good idea, as I’m sure many people would believe this to be a fault of the configuration (myself included! I haven’t ruled out the possibility)

How many posts the forum have?

What is the forum hardware specs?

What is the error logged in the logs page during those 502 errors?

If you have many posts and a underspecified server, the setting search prefer recent posts may help.

4 Likes

…as I went to go look up that information, I tried some of the failing searches and found that they now work perfectly. Amazing? Thanks anyway. I wonder if it was just postgres “warming up”.

2 Likes

Very likely, if for any reason a search takes longer than 30 seconds you will see this kind of timeout. The web worker gets killed and NGINX sends a 502.

  • How many topics/posts are there on your forum?
  • What are the specs of your server?
  • If this is an import it may make sense to run a full vacuum VACUUM FULL - PostgreSQL wiki ./launcher enter app and then sudo -u postgres psql discourse
2 Likes

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