Nginx upstream timed out (110: Connection timed out)

こんにちは、私のサイトは https://1o24bbs.com/ です。

アップグレードも何の操作もしていないのに、突然 nginx が upstream への接続に失敗していると表示されました:http://127.0.0.1:3000

どのようにトラブルシューティングをすればよいでしょうか?ご支援をお願いします。

/shared/log/rails# tail -f unicorn.stdout.log

2021-07-08T09:01:03.403Z pid=682 tid=sim ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-07-08T09:01:03.412Z pid=682 tid=t4m ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-07-08T09:01:03.406Z pid=682 tid=tra ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-07-08T09:01:03.407Z pid=682 tid=sn6 ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

2021-07-08T09:01:03.407Z pid=682 tid=sze ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)

Sidekiq をプロセス ID 648 で読み込み中

Kill self supervisor が存在しません

Kill self supervisor が存在しません

Kill self supervisor が存在しません

Sidekiq をプロセス ID 780 で読み込み中

/var/log/redis# tail -f current

553:M 2021 年 7 月 8 日 09:11:59.078 * 60 秒間で 10000 件の変更が発生しました。保存中…

553:M 2021 年 7 月 8 日 09:11:59.079 * バックグラウンド保存が PID 1270 によって開始されました

1270:C 2021 年 7 月 8 日 09:12:01.584 * データベースがディスクに保存されました

1270:C 2021 年 7 月 8 日 09:12:01.595 * RDB: コピーオンライトで使用されたメモリは 0 MB

553:M 2021 年 7 月 8 日 09:12:01.619 * バックグラウンド保存が正常に完了しました

553:M 2021 年 7 月 8 日 09:13:02.098 * 60 秒間で 10000 件の変更が発生しました。保存中…

553:M 2021 年 7 月 8 日 09:13:02.099 * バックグラウンド保存が PID 1339 によって開始されました

1339:C 2021 年 7 月 8 日 09:13:04.052 * データベースがディスクに保存されました

1339:C 2021 年 7 月 8 日 09:13:04.055 * RDB: コピーオンライトで使用されたメモリは 0 MB

553:M 2021 年 7 月 8 日 09:13:04.137 * バックグラウンド保存が正常に完了しました

rebuild app の実行中に、エラー Failed listening on port 6379 が発生しました。

これは Discourse 公式の標準インストール ですか?

十分なディスク容量はありますか(再構築を試みた際に気づくはずです)。

これは Redis に問題があるようですが、ここに記載されている内容からは原因が特定できません。

はい、このウェブサイトは数年間正常に稼働しています。

もしかしたら、Redis の問題ではないのかもしれません。
Sidekiq はバックグラウンドジョブを処理するものですよね?

それによって http://127.0.0.1:3000 にアクセスできなくなることはないはずです。

nginx の追加ログ

2021/07/08 10:54:31 [error] 570#570: *169 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 100.19.76.187, server: _, request: “POST /message-bus/4cf07f106ff14fd885fd735ea28abce4/poll?dlp=t HTTP/2.0”, upstream: “http://127.0.0.1:3000/message-bus/4cf07f106ff14fd885fd735ea28abce4/poll?dlp=t”, host: “1o24bbs.com”, referrer: “https://1o24bbs.com/t/icc/25834

2021/07/08 10:54:32 [error] 570#570: *169 upstream timed out (110: Connection timed out) while connecting to upstream, client: 100.19.76.187, server: _, request: “POST /message-bus/fe81f75495324a109de3812a3c5a9abd/poll?dlp=t HTTP/2.0”, upstream: “http://127.0.0.1:3000/message-bus/fe81f75495324a109de3812a3c5a9abd/poll?dlp=t”, host: “1o24bbs.com”, referrer: “https://1o24bbs.com/t/icc/23914

2021/07/08 10:54:33 [error] 570#570: *169 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 100.19.76.187, server: _, request: “POST /message-bus/1dd105462c5b4b4c978e1702fa885e14/poll?dlp=t HTTP/2.0”, upstream: “http://127.0.0.1:3000/message-bus/1dd105462c5b4b4c978e1702fa885e14/poll?dlp=t”, host: “1o24bbs.com”, referrer: “https://1o24bbs.com/t/topic/15436

2021/07/08 10:54:36 [error] 570#570: *13261 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 220.196.56.24, server: _, request: “GET /?374e828961d36d46bd99dc8e13b7f640 HTTP/1.1”, upstream: “http://127.0.0.1:3000/?374e828961d36d46bd99dc8e13b7f640”, host: “1o24bbs.com”, referrer: “https://gateway.zscalertwo.net:443/auT?origurl=https%3A%2F%2F1o24bbs.com%2F%3F374e828961d36d46bd99dc8e13b7f640&wexps=1&_ordtok=SWk3WVhmhHBPJ4rLFk4nDRnkZ3&wexps=1

production.log には以下が表示されます。

Processing by CategoriesController#index as HTML
Parameters: {“41528430213d6ae753e074e11328b67b” => nil}
Job exception: FATAL: the database system is shutting down

@pfaffman Redisをフラッシュするにはどうすればよいですか?ありがとうございます!

PostgreSQL 13 の更新は完了しましたか。

ありがとうございます!
当サイトは Discourse の最新バージョンで動作しています。少なくとも 1 ヶ月は最新バージョンを運用しています。

PostgreSQL の手動アップグレードは行いませんでしたが、バージョンは 13 だと考えています。
それをどうやって確認すればよいでしょうか?

$ psql -V
psql (PostgreSQL) 13.3 (Debian 13.3-1.pgdg100+1)

余談ですが、私は単一のコンテナ app を実行しています。

標準外のプラグインは使用されていますか?

インストールされているプラグイン:

  • docker_manager
  • discourse-adplugin

Redis か PostgreSQL に問題があると思いますか?

# ./launcher enter appを実行した後、curl http://127.0.0.1:3000を実行するとタイムアウトします。

「いいね!」 1

discourse-doctor の出力:

==================== DOCKER 情報 ====================
DOCKER バージョン: Docker version 19.03.13, build 4484c46d9d

DOCKER プロセス (docker ps -a)

CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                   PORTS                                      NAMES
70709beca56d        local_discourse/app                "/sbin/boot"             15 分前             Up 15 分                   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app
1828993cd957        discourse/base:2.0.20210528-1735   "/bin/bash -c 'cd /p…"   2 時間前            終了 (1) 2 時間前                                              agitated_curie

70709beca56d        local_discourse/app   "/sbin/boot"        15 分前      Up 15 分       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app

Discourse コンテナ app は実行中です

==================== プラグイン ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-adplugin.git

非公式プラグインは検出されませんでした。

公式リストについては https://github.com/discourse/discourse/blob/master/lib/plugin/metadata.rb を参照してください。

========================================

すみません、アイデアがありません。最近再起動しましたか?

新しい VM を起動し、DB バックアップを使用して新しいコンテナを作成する必要がありました。
しかし、その後また同じ問題が発生しているようです…

同じ問題が、ある企業のウェブサイト foreign exchange send money online でも発生しました。サーバーを再起動し、タイムアウトを1000秒に変更してから再度試してみました。