502 Bad Gateway solo per due argomenti

I have a 502 Bad gateway for a topic (maybe more than one) on the discourse forum I host:

I just document my way here and see if someone can help.

I did

I wonder what to do. I will search a bit more.

HEAD requests

Here is a list of pages:

$ for i in `seq 100`; do ( status="`curl -L --head -o /dev/null -s -w '%{http_code}' https://ammanvalley.foss.wales/t/$i`"; echo "https://ammanvalley.foss.wales/t/$i - $status" ) done
https://ammanvalley.foss.wales/t/1 - 200
https://ammanvalley.foss.wales/t/2 - 404
https://ammanvalley.foss.wales/t/3 - 200
https://ammanvalley.foss.wales/t/4 - 404
https://ammanvalley.foss.wales/t/5 - 404
https://ammanvalley.foss.wales/t/6 - 404
https://ammanvalley.foss.wales/t/7 - 200 -- no 502
https://ammanvalley.foss.wales/t/8 - 404
https://ammanvalley.foss.wales/t/9 - 404
https://ammanvalley.foss.wales/t/10 - 200
https://ammanvalley.foss.wales/t/11 - 200
https://ammanvalley.foss.wales/t/12 - 200
https://ammanvalley.foss.wales/t/13 - 200
https://ammanvalley.foss.wales/t/14 - 200
https://ammanvalley.foss.wales/t/15 - 200
https://ammanvalley.foss.wales/t/16 - 404
https://ammanvalley.foss.wales/t/17 - 404
https://ammanvalley.foss.wales/t/18 - 200
https://ammanvalley.foss.wales/t/19 - 200
https://ammanvalley.foss.wales/t/20 - 404
https://ammanvalley.foss.wales/t/21 - 200
https://ammanvalley.foss.wales/t/22 - 200
https://ammanvalley.foss.wales/t/23 - 200
https://ammanvalley.foss.wales/t/24 - 200
https://ammanvalley.foss.wales/t/25 - 200
https://ammanvalley.foss.wales/t/26 - 404
https://ammanvalley.foss.wales/t/27 - 404
https://ammanvalley.foss.wales/t/28 - 200
https://ammanvalley.foss.wales/t/29 - 404
https://ammanvalley.foss.wales/t/30 - 200
https://ammanvalley.foss.wales/t/31 - 200
https://ammanvalley.foss.wales/t/32 - 200
https://ammanvalley.foss.wales/t/33 - 200
https://ammanvalley.foss.wales/t/34 - 200
https://ammanvalley.foss.wales/t/35 - 200
https://ammanvalley.foss.wales/t/36 - 404
https://ammanvalley.foss.wales/t/37 - 200
https://ammanvalley.foss.wales/t/38 - 200
https://ammanvalley.foss.wales/t/39 - 200
https://ammanvalley.foss.wales/t/40 - 404
https://ammanvalley.foss.wales/t/41 - 200
https://ammanvalley.foss.wales/t/42 - 200
https://ammanvalley.foss.wales/t/43 - 200
https://ammanvalley.foss.wales/t/44 - 200
https://ammanvalley.foss.wales/t/45 - 200
https://ammanvalley.foss.wales/t/46 - 200
https://ammanvalley.foss.wales/t/47 - 404
https://ammanvalley.foss.wales/t/48 - 200
https://ammanvalley.foss.wales/t/49 - 200
https://ammanvalley.foss.wales/t/50 - 200
https://ammanvalley.foss.wales/t/51 - 200
https://ammanvalley.foss.wales/t/52 - 200
https://ammanvalley.foss.wales/t/53 - 200
https://ammanvalley.foss.wales/t/54 - 200
https://ammanvalley.foss.wales/t/55 - 200
https://ammanvalley.foss.wales/t/56 - 200
https://ammanvalley.foss.wales/t/57 - 200
https://ammanvalley.foss.wales/t/58 - 200 -- no 502
https://ammanvalley.foss.wales/t/59 - 200
https://ammanvalley.foss.wales/t/60 - 200
https://ammanvalley.foss.wales/t/61 - 200
https://ammanvalley.foss.wales/t/62 - 404
https://ammanvalley.foss.wales/t/63 - 200
https://ammanvalley.foss.wales/t/64 - 404
https://ammanvalley.foss.wales/t/65 - 404
https://ammanvalley.foss.wales/t/66 - 200
https://ammanvalley.foss.wales/t/67 - 200
https://ammanvalley.foss.wales/t/68 - 404
https://ammanvalley.foss.wales/t/69 - 200
https://ammanvalley.foss.wales/t/70 - 404
https://ammanvalley.foss.wales/t/71 - 404
https://ammanvalley.foss.wales/t/72 - 404
https://ammanvalley.foss.wales/t/73 - 200
https://ammanvalley.foss.wales/t/74 - 404
https://ammanvalley.foss.wales/t/75 - 404
https://ammanvalley.foss.wales/t/76 - 404
https://ammanvalley.foss.wales/t/77 - 404
https://ammanvalley.foss.wales/t/78 - 404
https://ammanvalley.foss.wales/t/79 - 404
https://ammanvalley.foss.wales/t/80 - 404
https://ammanvalley.foss.wales/t/81 - 404
https://ammanvalley.foss.wales/t/82 - 404
https://ammanvalley.foss.wales/t/83 - 404
https://ammanvalley.foss.wales/t/84 - 404
https://ammanvalley.foss.wales/t/85 - 404
https://ammanvalley.foss.wales/t/86 - 404
https://ammanvalley.foss.wales/t/87 - 404
https://ammanvalley.foss.wales/t/88 - 404
https://ammanvalley.foss.wales/t/89 - 404
https://ammanvalley.foss.wales/t/90 - 404
https://ammanvalley.foss.wales/t/91 - 404
https://ammanvalley.foss.wales/t/92 - 404
https://ammanvalley.foss.wales/t/93 - 404
https://ammanvalley.foss.wales/t/94 - 404
https://ammanvalley.foss.wales/t/95 - 404
https://ammanvalley.foss.wales/t/96 - 404
https://ammanvalley.foss.wales/t/97 - 404
https://ammanvalley.foss.wales/t/98 - 404
https://ammanvalley.foss.wales/t/99 - 404
https://ammanvalley.foss.wales/t/100 - 404

GET requests

$ for i in `seq 100`; do ( status="`curl -L -o /dev/null -s -w '%{http_code}' https://ammanvalley.foss.wales/t/$i`"; echo "https://ammanvalley.foss.wales/t/$i - $status" ) done
https://ammanvalley.foss.wales/t/1 - 200
https://ammanvalley.foss.wales/t/2 - 404
https://ammanvalley.foss.wales/t/3 - 200
https://ammanvalley.foss.wales/t/4 - 404
https://ammanvalley.foss.wales/t/5 - 404
https://ammanvalley.foss.wales/t/6 - 404
https://ammanvalley.foss.wales/t/7 - 502  -- 502
https://ammanvalley.foss.wales/t/8 - 404
https://ammanvalley.foss.wales/t/9 - 404
https://ammanvalley.foss.wales/t/10 - 200
https://ammanvalley.foss.wales/t/11 - 200
https://ammanvalley.foss.wales/t/12 - 200
https://ammanvalley.foss.wales/t/13 - 200
https://ammanvalley.foss.wales/t/14 - 200
https://ammanvalley.foss.wales/t/15 - 200
https://ammanvalley.foss.wales/t/16 - 404
https://ammanvalley.foss.wales/t/17 - 404
https://ammanvalley.foss.wales/t/18 - 200
https://ammanvalley.foss.wales/t/19 - 200
https://ammanvalley.foss.wales/t/20 - 404
https://ammanvalley.foss.wales/t/21 - 200
https://ammanvalley.foss.wales/t/22 - 200
https://ammanvalley.foss.wales/t/23 - 200
https://ammanvalley.foss.wales/t/24 - 200
https://ammanvalley.foss.wales/t/25 - 200
https://ammanvalley.foss.wales/t/26 - 404
https://ammanvalley.foss.wales/t/27 - 404
https://ammanvalley.foss.wales/t/28 - 200
https://ammanvalley.foss.wales/t/29 - 404
https://ammanvalley.foss.wales/t/30 - 200
https://ammanvalley.foss.wales/t/31 - 200
https://ammanvalley.foss.wales/t/32 - 200
https://ammanvalley.foss.wales/t/33 - 200
https://ammanvalley.foss.wales/t/34 - 200
https://ammanvalley.foss.wales/t/35 - 200
https://ammanvalley.foss.wales/t/36 - 404
https://ammanvalley.foss.wales/t/37 - 200
https://ammanvalley.foss.wales/t/38 - 200
https://ammanvalley.foss.wales/t/39 - 200
https://ammanvalley.foss.wales/t/40 - 404
https://ammanvalley.foss.wales/t/41 - 200
https://ammanvalley.foss.wales/t/42 - 200
https://ammanvalley.foss.wales/t/43 - 200
https://ammanvalley.foss.wales/t/44 - 200
https://ammanvalley.foss.wales/t/45 - 200
https://ammanvalley.foss.wales/t/46 - 200
https://ammanvalley.foss.wales/t/47 - 404
https://ammanvalley.foss.wales/t/48 - 200
https://ammanvalley.foss.wales/t/49 - 200
https://ammanvalley.foss.wales/t/50 - 200
https://ammanvalley.foss.wales/t/51 - 200
https://ammanvalley.foss.wales/t/52 - 200
https://ammanvalley.foss.wales/t/53 - 200
https://ammanvalley.foss.wales/t/54 - 200
https://ammanvalley.foss.wales/t/55 - 200
https://ammanvalley.foss.wales/t/56 - 200
https://ammanvalley.foss.wales/t/57 - 200
https://ammanvalley.foss.wales/t/58 - 502 -- 502
https://ammanvalley.foss.wales/t/59 - 200
https://ammanvalley.foss.wales/t/60 - 200
https://ammanvalley.foss.wales/t/61 - 200
https://ammanvalley.foss.wales/t/62 - 404
https://ammanvalley.foss.wales/t/63 - 200
https://ammanvalley.foss.wales/t/64 - 404
https://ammanvalley.foss.wales/t/65 - 404
https://ammanvalley.foss.wales/t/66 - 200
https://ammanvalley.foss.wales/t/67 - 200
https://ammanvalley.foss.wales/t/68 - 404
https://ammanvalley.foss.wales/t/69 - 200
https://ammanvalley.foss.wales/t/70 - 404
https://ammanvalley.foss.wales/t/71 - 404
https://ammanvalley.foss.wales/t/72 - 404
https://ammanvalley.foss.wales/t/73 - 200
https://ammanvalley.foss.wales/t/74 - 404
https://ammanvalley.foss.wales/t/75 - 404
https://ammanvalley.foss.wales/t/76 - 404
https://ammanvalley.foss.wales/t/77 - 404
https://ammanvalley.foss.wales/t/78 - 404
https://ammanvalley.foss.wales/t/79 - 404
https://ammanvalley.foss.wales/t/80 - 404
https://ammanvalley.foss.wales/t/81 - 404
https://ammanvalley.foss.wales/t/82 - 404
https://ammanvalley.foss.wales/t/83 - 404
https://ammanvalley.foss.wales/t/84 - 404
https://ammanvalley.foss.wales/t/85 - 404
https://ammanvalley.foss.wales/t/86 - 404
https://ammanvalley.foss.wales/t/87 - 404
https://ammanvalley.foss.wales/t/88 - 404
https://ammanvalley.foss.wales/t/89 - 404
https://ammanvalley.foss.wales/t/90 - 404
https://ammanvalley.foss.wales/t/91 - 404
https://ammanvalley.foss.wales/t/92 - 404
https://ammanvalley.foss.wales/t/93 - 404
https://ammanvalley.foss.wales/t/94 - 404
https://ammanvalley.foss.wales/t/95 - 404
https://ammanvalley.foss.wales/t/96 - 404
https://ammanvalley.foss.wales/t/97 - 404
https://ammanvalley.foss.wales/t/98 - 404
https://ammanvalley.foss.wales/t/99 - 404
https://ammanvalley.foss.wales/t/100 - 404

Logs

A list of errors from ./launcher logs app:

...
[Wed 26 Oct 2022 04:28:27 PM UTC] Run reload cmd: sv reload nginx
fail: nginx: runsv not running
[Tue 25 Oct 2022 01:07:47 PM UTC] Run reload cmd: sv reload nginx
warning: nginx: unable to open supervise/ok: file does not exist
[Tue 25 Oct 2022 01:07:47 PM UTC] ESC[1;31mReload error for :ESC[0m
Started runsvdir, PID is 552
[Tue 25 Oct 2022 01:07:45 PM UTC] Run reload cmd: sv reload nginx
warning: nginx: unable to open supervise/ok: file does not exist
[Tue 25 Oct 2022 01:07:45 PM UTC] ESC[1;31mReload error for :ESC[0m
[Tue 25 Oct 2022 01:07:46 PM UTC] Domains not changed.

Further investigation

I am unsure about how to proceed with this. It affects only two topics.
The previews work, the data does not:

How do I restore the posts?

1 Mi Piace

Quegli argomenti sono stati eliminati? Potrebbero essere messaggi privati? Li stai richiedendo come amministratore?

Oh, scusa, è un 502; puoi dare un’occhiata a /var/discourse/shared/logs/rails/production.log e vedere se ci sono indizi lì. Vedi anche https://ammanvalley.foss.wales/logs

1 Mi Piace

Hm, rails è felice e registra molto velocemente.

Started GET "/t/wip-arduino-workshop/58" for 8.8.8.8 at 2022-10-26 20:57:4
8 +0000
Processing by TopicsController#show as HTML
  Parameters: {"slug"=>"wip-arduino-workshop", "topic_id"=>"58"}
start
done

Quindi, il sito web continua a caricarsi per un po’ finché non appare il 502.

Tuttavia, ricevo molti errori qui /var/discourse/shared/standalone/log/rails/production.log:

Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 2 Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) subscribe failed, reconnecting in 1 second. Call stack /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:398:in `rescue in establish_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:379:in `establish_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:115:in `block in connect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:344:in `with_reconnect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:114:in `connect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:417:in `ensure_connected'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:269:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:356:in `logging'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:268:in `process'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:175:in `block in call_loop'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:331:in `with_socket_timeout'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/client.rb:174:in `call_loop'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/subscribe.rb:44:in `subscription'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/subscribe.rb:14:in `subscribe'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis.rb:287:in `_subscription'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/commands/pubsub.rb:20:in `block in subscribe'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis.rb:264:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis.rb:264:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis.rb:264:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.7.1/lib/redis/commands/pubsub.rb:19:in `subscribe'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-4.2.0/lib/message_bus/backends/redis.rb:302:in `global_subscribe'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-4.2.0/lib/message_bus.rb:763:in `global_subscribe_thread'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-4.2.0/lib/message_bus.rb:734:in `block in new_subscriber_thread' 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Job exception: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
 
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Job exception: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
 
2022-10-26 16:31:02 +0000: Issuing stop to sidekiq
I, [2022-10-26T16:31:04.563256 #2079]  INFO -- : executing ["/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/unicorn", "-E", "production", "-c", "config/unico
rn.conf.rb", {10=>#<Unicorn::TCPSrv:fd 10, AF_INET, 127.0.0.1, 3000>}] (in /var/www/discourse)
I, [2022-10-26T16:31:04.563661 #2079]  INFO -- : forked child re-executing...
I, [2022-10-26T16:31:07.250986 #2079]  INFO -- : inherited addr=127.0.0.1:3000 fd=10
I, [2022-10-26T16:31:07.252783 #2079]  INFO -- : Refreshing Gem list
I, [2022-10-26T16:31:44.617034 #2079]  INFO -- : starting 1 supervised sidekiqs
I, [2022-10-26T16:31:47.752185 #2079]  INFO -- : master process ready
I, [2022-10-26T16:31:55.330063 #589]  INFO -- : reaped #<Process::Status: pid 704 exit 0> worker=1
I, [2022-10-26T16:31:55.333326 #589]  INFO -- : reaped #<Process::Status: pid 714 exit 0> worker=2
I, [2022-10-26T16:31:55.333928 #589]  INFO -- : reaped #<Process::Status: pid 1740 exit 0> worker=0
I, [2022-10-26T16:31:55.335869 #589]  INFO -- : master complete
I, [2022-10-26T16:32:26.504213 #2414]  INFO -- : worker=0 ready
2022-10-26 16:32:27 +0000: Issuing stop to sidekiq
I, [2022-10-26T16:32:28.194731 #2429]  INFO -- : worker=1 ready
I, [2022-10-26T16:32:29.025684 #2445]  INFO -- : worker=2 ready
Process would not terminate cleanly, force quitting. pid: 2402 Demon::Sidekiq
I, [2022-10-26T16:32:38.212437 #2079]  INFO -- : reaped #<Process::Status: pid 2429 exit 0> worker=1
I, [2022-10-26T16:32:38.212904 #2079]  INFO -- : reaped #<Process::Status: pid 2445 exit 0> worker=2
oxipng worker: could not get version of oxipng at /usr/local/bin/oxipng; please provide proper binary or disable this worker (--no-oxipng argument or `:oxipng => false` through options)
oxipng worker: could not get version of oxipng at /usr/local/bin/oxipng; please provide proper binary or disable this worker (--no-oxipng argument or `:oxipng => false` through options)
E, [2022-10-26T17:47:01.151902 #5094] ERROR -- : worker=0 PID:7920 timeout (31s > 30s), killing
I, [2022-10-26T21:01:44.288907 #10359]  INFO -- : worker=1 ready
I, [2022-10-26T21:02:06.344069 #10391]  INFO -- : worker=0 ready
I, [2022-10-26T21:02:10.336134 #10410]  INFO -- : worker=2 ready
D, [2022-10-26T21:02:14.022594 #595] DEBUG -- : waiting 16.0s after suspend/hibernation
E, [2022-10-26T21:02:39.047922 #595] ERROR -- : worker=1 PID:10359 timeout (31s > 30s), killing
E, [2022-10-26T21:02:39.175049 #595] ERROR -- : reaped #<Process::Status: pid 10359 SIGKILL (signal 9)> worker=1
E, [2022-10-26T21:02:44.202628 #595] ERROR -- : worker=0 PID:10391 timeout (31s > 30s), killing
E, [2022-10-26T21:02:44.327961 #595] ERROR -- : reaped #<Process::Status: pid 10391 SIGKILL (signal 9)> worker=0
I, [2022-10-26T21:03:08.803095 #10488]  INFO -- : worker=1 ready
E, [2022-10-26T21:03:11.378475 #595] ERROR -- : worker=2 PID:10410 timeout (31s > 30s), killing
E, [2022-10-26T21:03:11.456868 #595] ERROR -- : worker=2 PID:10410 timeout (31s > 30s), killing
E, [2022-10-26T21:03:11.548047 #595] ERROR -- : reaped #<Process::Status: pid 10410 SIGKILL (signal 9)> worker=2

Controlla anche i file in /var/log/nginx/ per indizi.

Vedo che https://ammanvalley.foss.wales/t/welcome-to-amman-valley-makerspace/7.json non restituisce nulla e poi dà il 502.

Hai qualche plugin installato?

Hai riavviato di recente? Quanta RAM e swap hai?

Sembra che ci sia qualche problema con Redis. Non riesco a pensare a un motivo per cui questi due argomenti causerebbero ciò.

https://ammanvalley.foss.wales/t/plugins-to-install/14

No, ma ho riavviato l’app, l’ho ricostruita e aggiornata tramite l’interfaccia web.

Quindi l’output di nginx attende il timeout in access.log e poi produce questo:

[27/Oct/2022:05:45:48 +0000] "ammanvalley.foss.wales" 8.8.8.8 "GET /t/wip-arduino-workshop/58 HTTP/2.0" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:105.
0) Gecko/20100101 Firefox/105.0" "-" 502 217 "https://meta.discourse.org/" 30.516 30.516 "-" "-" "-" "-" "-" "-" "-"

In error.log, posso vedere questo:

2022/10/26 21:03:48 [error] 578#578: *509 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 46.59.192.44, se\nrver: _, request: "GET /t/wip-arduino-workshop/58 HTTP/2.0", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales", refe\nrrer: "https://meta.discourse.org/"
2022/10/26 21:05:58 [error] 575#575: *591 upstream prematurely closed connection while reading response header from upstream, client: 189.79.134.158, server:
_, request: "GET /t/wip-arduino-workshop/58 HTTP/2.0", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales", referrer:
"https://meta.discourse.org/"
2022/10/26 21:52:07 [error] 578#578: *1117 upstream prematurely closed connection while reading response header from upstream, client: 216.68.248.7, server: _
, request: "GET /t/welcome-to-amman-valley-makerspace/7 HTTP/1.1", upstream: "http://127.0.0.1:3000/t/welcome-to-amman-valley-makerspace/7", host: "ammanvalle\ny.foss.wales"
2022/10/26 22:33:23 [error] 578#578: *1534 upstream prematurely closed connection while reading response header from upstream, client: 64.222.212.196, server:
 _, request: "GET /t/wip-arduino-workshop/58 HTTP/1.1", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales"
2022/10/27 05:21:21 [crit] 578#578: *2066 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handsh\naking, client: 64.62.197.155, server: 0.0.0.0:443
2022/10/27 05:44:54 [error] 578#578: *2073 upstream prematurely closed connection while reading response header from upstream, client: 92.40.170.157, server:
_, request: "GET /t/wip-arduino-workshop/58 HTTP/2.0", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales", referrer:
"https://meta.discourse.org/"
2022/10/27 05:45:48 [error] 578#578: *2073 upstream prematurely closed connection while reading response header from upstream, client: 92.40.170.157, server:
_, request: "GET /t/wip-arduino-workshop/58 HTTP/2.0", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales", referrer:
"https://meta.discourse.org/"
2022/10/27 05:48:48 [error] 575#575: *2161 upstream prematurely closed connection while reading response header from upstream, client: 92.40.170.156, server:
_, request: "GET /t/wip-arduino-workshop/58 HTTP/2.0", upstream: "http://127.0.0.1:3000/t/wip-arduino-workshop/58", host: "ammanvalley.foss.wales", referrer:
"https://meta.discourse.org/"

SWAP: 311M/2.97G RAM: 1.13G/1.93G

il raw è lì, però, e sembra innocuo.
Mi chiedo cosa mostrerebbe la console di Rails…

rails c
Topic.where(id: 58)

Sono entrato nella console di Rails.

pry(main)> Topic.where(id: 58)
=> [#<Topic:0x0000aaab01b22260
  id: 58,
  title: "[WIP] Arduino Workshop",
  last_posted_at: Sun, 23 Oct 2022 22:13:09.895053000 UTC +00:00,
  created_at: Fri, 23 Sep 2022 10:30:18.827248000 UTC +00:00,
  updated_at: Sun, 23 Oct 2022 22:13:10.291385000 UTC +00:00,
  views: 26,
  posts_count: 6,
  user_id: 1,
  last_post_user_id: 1,
  reply_count: 4,
  featured_user1_id: 2,
  featured_user2_id: nil,
  featured_user3_id: nil,
  deleted_at: nil,
  highest_post_number: 6,
  like_count: 1,
  incoming_link_count: 16,
  category_id: 6,
  visible: true,
  moderator_posts_count: 0,
  closed: false,
  archived: false,
  bumped_at: Sun, 23 Oct 2022 22:13:09.895053000 UTC +00:00,
  has_summary: false,
  archetype: "regular",
  featured_user4_id: nil,
  notify_moderators_count: 0,
  spam_count: 0,
  pinned_at: nil,
  score: 11.233333333333333,
  percent_rank: 1.0,
  subtype: nil,
  slug: "wip-arduino-workshop",
  deleted_by_id: nil,
  participant_count: 2,
  word_count: 184,
  excerpt:
   "I can run a workshop to introduce into programming arduinos. I post this here, so that we can organize \n\nOrganization\n\n\n make a poster @DomAman made one\n\n get material down from the community center\n\n make a list of what…",
  pinned_globally: false,
  pinned_until: nil,
  fancy_title: "[WIP] Arduino Workshop",
  highest_staff_post_number: 6,
  featured_link: nil,
  reviewable_score: 0.0,
  image_upload_id: nil,
  slow_mode_seconds: 0,
  bannered_until: nil,
  external_id: nil>]
1 Mi Piace

Sembra che https://ammanvalley.foss.wales/raw/58 funzioni correttamente.
Quando è iniziato?

2 Mi Piace

Grazie mille per il link grezzo! Questo aiuta a supportare gli argomenti.

Un nuovo link ora dà errore 502: https://ammanvalley.foss.wales/t/hovercraft-project/93

Hm. Ho fatto aggiornamenti, ho disabilitato i plugin. Il nuovo link è stato creato poco tempo fa. Nessun aggiornamento, nessuna disabilitazione, niente di amministrativo.

No! Ora funziona! Hm. Non capisco.
Ora sembra risolto: tutti e tre i post vengono visualizzati in HTML senza alcun errore. Devo chiudere ora? Se qualcuno è interessato a proseguire, per favore commenti. Lascio la chiusura al tempo.

1 Mi Piace

No! Non è risolto. Il forum è stato riavviato 30 minuti fa e il 502 appare su altri post:

https://ammanvalley.foss.wales/t/hovercraft-project/93
https://ammanvalley.foss.wales/t/welcome-to-amman-valley-makerspace/7
https://ammanvalley.foss.wales/t/wip-arduino-workshop/58

Il forum generalmente si carica lentamente a volte. C’è un modo per aumentare il timeout? I collegamenti diretti funzionano!
image

Non so davvero cosa fare con questo.

Quindi il 502 si verifica effettivamente a causa del timeout, si verifica poco più di 30 secondi.

Cosa sta succedendo in Sidekiq? C’è una coda di grandi dimensioni?

1 Mi Piace

Allora è quello che affronterei.

Raddoppierei la tua RAM o prenderei una CPU più veloce. Se sei su hosting condiviso (come la maggior parte dei droplet di Digital Ocean, potresti avere un “vicino rumoroso” che ti sta rallentando).

Inoltre, se non hai ancora riavviato il tuo sistema operativo, potrebbe aver aggiornato alcune librerie che stanno occupando RAM.

Stai effettivamente funzionando su una CPU arm, o quell’etichetta è errata?

1 Mi Piace

Sì, è una CPU ARM. Ho chiesto accidentalmente ulteriori informazioni e ho scoperto che quando apro una pagina 502, vedo questo processo aumentare:

unicorn worker[1] -E production -c config/unicorn.conf.rb

99.0 è la percentuale della CPU:
image

E questo rimane attivo anche diversi secondi dopo che una pagina 502 viene restituita al browser. Cosa sta facendo?

Come posso verificarlo?

Hm. Questi sono i requisiti minimi. Inoltre, la RAM non aumenta mai o sembra nemmeno muoversi.

Quindi il processo unicorn è responsabile del rendering della pagina e del suo passaggio a nginx. Dopo 30 secondi, nginx rinuncia, ma il processo unicorn non lo sa, quindi continua a renderizzare la pagina.

La domanda è: perché unicorn impiega così tanto tempo a renderizzare certi argomenti?

Penso che la tua RAM vada bene.

Potresti provare a usare il mini-profiler per vedere cosa sta succedendo. Qui c’è come fare (è nel contesto di un problema non correlato).

Puoi controllare su Sidekiq andando su /sidekiq come amministratore.

2 Mi Piace


Sembra che non succeda nulla di particolare per sidekiq: l’unico picco di processo si verifica quando il browser invia la richiesta GET.

Noto che questo accade con gli argomenti di risposta. Potrebbe anche essere solo perché ho maggiori probabilità di visitarli.

Ho difficoltà ad aprirlo. La scorciatoia non funziona. Quando ho cliccato su un post che genera un 502, si è aperto nella pagina in cui ho cliccato e poi è scomparso. Al momento non so come aprirlo. Posso eseguire del JavaScript.

La mia domanda al momento è: c’è un modo per aumentare il time-out di nginx da, diciamo, 30 secondi a circa due minuti? Questo probabilmente risolverebbe il problema.

La mia conclusione è che posso scrivere un template che aggiunge un file .conf a /etc/nginx/sites-enabled/ che imposta i timeout.


Inoltre, ho notato che osservo questo 502 con maggiore probabilità quando è stata pubblicata una risposta. La mia ipotesi è che il forum debba ricostruire la pagina e ciò richiede un po’ di tempo. È corretto? Mi chiedo: posso attivare manualmente la ricostruzione di una pagina di discourse?

Il mio tentativo:

/var/discourse# cat templates/web.proxy_read_timeout.template.yml 
#
# Imposta il timeout per le letture del proxy nginx su sistemi lenti.
# Vedi https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout
# Vedi https://meta.discourse.org/t/502-bad-gateway-for-only-two-topics/242981/20?u=niccokunzmann
#
run:
  - file:
     path: "/etc/nginx/conf.d/proxy_read_timeout.conf"
     contents: |
       proxy_read_timeout 180s;

Poi, l’ho aggiunto in containers/app.yml:

templates:
# ...
  - "templates/web.proxy_read_timeout.template.yml"

Poi, ho eseguito

./launcher rebuild app

Per ora, non vedo più comparire questi errori.

1 Mi Piace