Errori 502 "casuali"

Ho un’installazione di Discourse in esecuzione su un server GCE. Gli utenti hanno segnalato problemi con il sistema che restituisce casualmente errori 502. Posso replicare la situazione cliccando sui link Latest, New, Unread, Top e Categories. Prima o poi uno di questi restituirà un errore 502.

Ho controllato i log del mio server proxy e vengono registrati voci come questa per gli URL non riusciti:
“upstream prematurely closed connection while reading response header from upstream”. Ci sono un numero molto elevato di questi errori, per URL apparentemente casuali.

Ecco i passaggi che ho intrapreso per tentare di risolvere il problema basandomi su post che ho letto:

  • Aggiornato il sistema operativo
  • Aggiornato Docker
  • Aggiornato Discourse
  • Riavviato il server

L’installazione originale è stata eseguita utilizzando la guida Docker Cloud Setup. Ho poi seguito una guida per passare i backup e le immagini a utilizzare S3.

Il mio server esegue:
Ubuntu 14.04.6 LTS (GNU/Linux 4.4.0-148-generic x86_64)

Secondo discourse-doctor:

     VERSIONE DI DOCKER: Docker version 18.06.3-ce, build d7080c1

==================== INFORMAZIONI SULLA MEMORIA ====================
RAM (MB): 4820

             total       used       free     shared    buffers     cached
Mem:          4707       2206       2501        140        101        948
-/+ buffers/cache:       1156       3550
Swap:         2047          0       2047

==================== CONTROLLO SPAZIO SU DISCO ====================
---------- Spazio su disco del sistema operativo ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   33G   15G  70% /
/dev/sda1        50G   33G   15G  70% /var/lib/docker

==================== INFORMAZIONI SUL DISCO ====================

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *       16065   104856254    52420095   83  Linux
Partition 1 does not start on physical sector boundary.

==================== FINE INFORMAZIONI SUL DISCO ====================

Ho eseguito top e ho monitorato i valori di CPU e memoria, senza rilevare nulla di preoccupante. Ho esaminato i log e non ho trovato nulla che indichi la causa del problema.

Posso fornire altri dettagli per aiutare a risolvere il problema? Quali passaggi dovrei intraprendere per individuarne la causa?

Grazie,

Stephen

1 Mi Piace

It could be that Postgres needs a bit more memory. You’ve got plenty, so you might bump db_shared_buffers to 1024MB. You might also bump db_work_mem to 80MB.

Thank you for the suggestion. I made both of those changes in the yml file. Restarting the app didn’t seem to make a difference, so I ended up rebooting the server. Unfortunately I can still replicate the problem.

You need to rebuild or

cd /var/discourse
./launcher destroy app
./launcher start app

for the changes to take effect.

And, this might not be a silver bullet, but I have seen it help.

2 Mi Piace

So far so good, we’ll monitor and see how this helps. Thank you!

2 Mi Piace