Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[不具合] 不定期にサーバがInternal Error を返しているので、原因を特定して修正しましょう #1669

Open
9 of 13 tasks
KATO-Hiro opened this issue Jan 22, 2025 · 4 comments
Labels
bug Something isn't working priority high

Comments

@KATO-Hiro
Copy link
Collaborator

KATO-Hiro commented Jan 22, 2025

WHY

  • 安定して稼働させることが求められているため / そのような状態をできるだけ実現したいため
  • サービスの信用問題に直接影響するため

TODO

  • ログを確認
    • Vercel
    • supabase
  • 原因を特定
  • 対処方法を調べる
  • 原因となっている部分を修正
    • local
    • staging
    • produciton
  • 動作確認
    • local
    • staging
    • produciton
@KATO-Hiro KATO-Hiro added bug Something isn't working priority high labels Jan 22, 2025
@KATO-Hiro
Copy link
Collaborator Author

KATO-Hiro commented Jan 25, 2025

本番環境用のデータベースにアクセスできないことによるエラーが発生しています。
アクセス量が相対的に多い時間帯(10:00〜10:30、12:30〜13:30、18:00〜19:30、20:30〜21:30)で発生する傾向にあります。

## Vercelでエラーが発生しているログの一部抜粋

PrismaClientInitializationError: 
Invalid `prisma.session.findUnique()` invocation:

Can't reach database server at ''

もしくは、

PrismaClientKnownRequestError: 
Invalid `prisma.session.findUnique()` invocation:

Can't reach database server at ''
## supabaseのログ

ClientHandler: MaxClientsInSessionMode: max clients reached - in Session mode max clients are limited to pool_size


DbHandler: Error auth response ["SFATAL", "VFATAL", "CXX000", "MMaxClientsInSessionMode: max clients reached - in Session mode max clients are limited to pool_size"]

@KATO-Hiro
Copy link
Collaborator Author

KATO-Hiro commented Jan 25, 2025

本番環境のDBの状態(1/18 - 1/25)

DBへの接続数の上限を30から48に引き上げましたが、それでも超過しています
アイドリング状態の接続が解放されていない可能性があります
Image

Image

Image

@KATO-Hiro
Copy link
Collaborator Author

Supabase において、DB接続の管理方法を session mode にしていることが原因かもしれません。
transaction mode へ移行すると緩和される可能性があります。

See

https://github.com/orgs/supabase/discussions/22305

KATO-Hiro added a commit that referenced this issue Feb 2, 2025
🐛 Try to fix "Max client connections reached" errors transaction mode (#1669)
@KATO-Hiro
Copy link
Collaborator Author

KATO-Hiro commented Feb 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority high
Projects
None yet
Development

No branches or pull requests

1 participant