JavaWebStack / JavaWebStack/orm
Queue.take in SQLPool can produce deadlock
還沒有人認領這個 Issue。
- 主要語言
- 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.
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從使用 Queue.take 的 SQLPool 路徑開始,然後在 pool 大小為 1 時呼叫 get 兩次來重現問題。比較目前的阻塞行為與預期的計時等待和例外,並確認在沒有可用連線時應用程式不會再一直卡住。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100