AtCoderNoviSteps icon indicating copy to clipboard operation
AtCoderNoviSteps copied to clipboard

回答状況の更新が失敗するケースがあるので修正しましょう

Open KATO-Hiro opened this issue 1 year ago • 7 comments

Summary / 概要

  • 不定期で回答状況の更新が失敗 + サーバが一時的にダウンしている時間帯がある

Steps to reproduce / 再現方法

  1. adminによる問題(集)の追加・更新と一般ユーザの回答更新のリクエストが同時に発生すると、20〜30分程度不安定に
  2. yyy
  3. zzz

environments

  • Desktop (please complete the following information):

    OS: [e.g. Mac, Windows11, Linux] Browser [e.g. Chrome, Safari, Edge, Firefox] Version [e.g. 117.0.05938.44]

  • Smartphone (please complete the following information):

    Device: [e.g. iPhone15, Android13] OS: [e.g. iOS16.5, Android 13] Browser [e.g. Chrome, Safari] Version [e.g. 16.5]

  • Tablet (please complete the following information):

    OS: [e.g. Android OS, Chrome OS, Windows11, iPad OS] Browser [e.g. Chrome, Safari, Edge, Firefox] Version [e.g. 16.5]

Expected behavior / 期待される挙動

  • ユーザの回答状況が更新される
  • 管理者による問題の更新・追加,問題集の作成・更新ができる

Actual behavior / 実際の挙動

  • 回答状況の更新が失敗するケースがある
  • 20~30分程度上記の状態が続くが,頻度はそこまで高くない
    • ユーザ数の増加により,同様の事例が増えることは予想される

Screenshots

  • If applicable, add screenshots to help explain your problem.

Other notes / その他

  • Add any other context about the problem here.
  • Will you try to create a pull request?
    • yes / no

KATO-Hiro avatar Sep 25 '24 09:09 KATO-Hiro

対処方法(案)

  • サーバのログを確認
  • トランザクション処理を実装
    • 問題の作成・更新・削除
    • 問題集の作成・更新・削除
  • キャッシュの導入
  • リバースプロキシ?の導入 / 設定の見直し

KATO-Hiro avatar Sep 26 '24 01:09 KATO-Hiro

https://www.prisma.io/docs/orm/reference/error-reference

KATO-Hiro avatar Sep 27 '24 05:09 KATO-Hiro

https://www.prisma.io/docs/accelerate/caching

KATO-Hiro avatar Sep 27 '24 06:09 KATO-Hiro

Failed to update task result:  PrismaClientKnownRequestError: 
Invalid `prisma.taskAnswer.upsert()` invocation:


Unique constraint failed on the fields: (`id`)
    at Mn.handleRequestError ...

KATO-Hiro avatar Sep 28 '24 10:09 KATO-Hiro

Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 5)

KATO-Hiro avatar Sep 30 '24 22:09 KATO-Hiro

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


Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 5)

KATO-Hiro avatar Oct 04 '24 09:10 KATO-Hiro


Can't reach database server at `...`

Please make sure your database server is running at `...`.

 code: 'P1001',

KATO-Hiro avatar Nov 13 '24 08:11 KATO-Hiro