JavaWebStack / JavaWebStack/orm

Queue.take in SQLPool can produce deadlock

未关闭
#58 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从使用 Queue.take 的 SQLPool 路径开始,然后通过在 pool 大小为 1 时调用 get 两次来复现问题。将当前的阻塞行为与预期的定时等待和异常进行比较,并验证在没有可用连接时应用程序不再一直卡住。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。