concurrent transaction throw deadlock error
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, mysql
调研方向
从 issue 中的事务代码开始,使用两个 pm2 实例、MySQL 以及所述的 JMeter 并发数复现报告的工作负载。检查事务在每条路径上是否始终一致地提交或回滚;完成的标准是确定 deadlock 的原因,或确认应用程序代码不负责任。
由索引模型根据 Issue 内容生成。
描述
pm2 start server with two instance ,
two instance connect one mysql server.

Component.queue = async (obj, appId, projectId, accessToken) => {
const Project = Component.app.models.project;
const Page = Component.app.models.page;
const tx = await Project.beginTransaction({
isolationLevel: Project.Transaction.REPEATABLE_READ
});
const options = { transaction: tx };
try {
const userId = accessToken.userId;
const { pageId, data = [] } = obj;
const project = await Project.findOne({
where: { id: projectId, appId, ownerId: userId }
}, options);
const info = await Project.updateAll(
{ id: projectId },
{ lastUpdate: new Date() },
options
);
let page = await Page.findById(pageId, options);
let pages = await Page.find({
where: { projectId }
}, options)
pages.forEach(page => {
if (page.uuid)
idMap[page.uuid] = page.id;
})
let components = await Component.find(
{
where: { projectId, pageId: page.id },
fields: ["id", "uuid"]
}, options
)
await Page.updateAll({ id: page.id }, { isNeedGenerate: true }, options);
await tx.commit();
return { success: true };
} catch (err) {
if (tx) {
await tx.rollback();
}
};
i use Jmeter test it , with 50 threads / sec, then throw error
but threads number small for example less than 10, they work well,
mysql deallock

error

so,did i write the code ok ? thanks
it seem miss commit or rollback while concurrent
- 主要语言
- JavaScript
- 星标
- 279
- 派生
- 362
- 平均合并
- 21 小时 14 分钟
- 30 天内合并 PR
- 16
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
loopbackio/loopback-datasource-juggler 的其他 Issue
-
Breaking changes for `loopback-datasource-juggler@7` not listed anywhere可能重新可做 @dhmlau 于 158 天前认领,目前没有进行中的 PR。 未关闭bug
loopbackio/loopback-datasource-juggler#2548 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
loopbackio/loopback-datasource-juggler#2530 ·
维护者通常 1 天内回复
-
allow empty array in createAll可能已有人在做 @ajay-prajapati07 于 533 天前认领。 未关闭feature
难度 3/5 1-2 天 新手友好度 45/100
loopbackio/loopback-datasource-juggler#2409 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 25/100
loopbackio/loopback-datasource-juggler#2319 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 55/100
loopbackio/loopback-datasource-juggler#1968 ·
维护者通常 1 天内回复
查看 loopbackio/loopback-datasource-juggler 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
ipfs/ipfs-webui#2507 ·
-
Environments table lists page size 5 after 30可能已有人在做 @raus7n 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
litmuschaos/litmus#5743 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 63/100
anothaDev/luci-theme-vantage#143 ·
维护者通常 1 天内回复
-
desktop grp:admin-donors type:graphics-bug ui-admin
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
kingcharleslzy-ai/dsh-purge#282 ·
维护者通常 1 天内回复