JavaWebStack / JavaWebStack/orm

Queue.take in SQLPool can produce deadlock

オープン
#58 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Java
スター
7
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

Describe the Bug
In SQLPool we use take on the queue to wait for a connection to become available. If no connections become available (for example if a single thread is using up all connections) it produces a deadlock causing a lockup of the entire application since all database queries will run into a deadlock

To Reproduce
Steps to reproduce the behavior:

  1. Set the pool size to 1
  2. Call get once
  3. Call get a second time -> gets stuck

Expected behavior
The pool should use poll instead and throw an Exception after a reasonable amount of waiting time preventing a lockup of the entire application

Environment Information:

  • Java Language Level 8
  • Version 1.0.3

Additional Context
The root cause of this might be a different issue since the pool shouldn't have ran out of connections in the first place. We can check this issue once proper exceptions are thrown.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Queue.takeを使用するSQLPoolのパスから始め、getを2回呼び出して、プールサイズが1の場合に問題を再現します。現在のブロッキング動作を、想定される時間制限付きの待機およびExceptionと比較し、利用可能な接続がない場合でもアプリケーションが stuck のままにならないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。