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:
- Set the pool size to 1
- Call get once
- 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