Multi-threading causes race condition when resolving hangover duration
还没有人认领这个 Issue。
评估
调研方向
在启用多线程的情况下从教程末尾重现该问题,并将其与禁用多线程时的 dispatcher/mod.rs 进行比较。在调试器中检查 initiative_system.rs 和 encumbrance_system.rs,重点关注已删除的 Hangover 状态效果以及 datastore 仍然提供的数据。当实体被删除后,encumbrance_system.rs 观察到正确的状态修饰符(包括属性再次发生变化时)即表示完成。
由索引模型根据 Issue 内容生成。
描述
Running the project from the end of the tutorial.
initiative_system.rs:
Visually verified the code in my project matches the source code from the last chapter of the tutorial.
Stepped through with debugger and code executes as expected. The equipment changed component is added to the player entity and the status effect is deleted from the entities list.
encumbrance_system.rs:
Visually verified the relevant code in my project matches the source code from the last chapter of the tutorial.
Stepped through with debugger and code does not execute as expected. In the section where status effects are calculated, the "Hangover" status effect data is still being served from the datastore after the Status Effect entity has been deleted from the entities list in initiative_syste.rs (visually inspected in the debugger.)
Turning multi-threading off by commenting out the multi-threading pre-processor code in dispatcher/mod.rs fixes the problem.
When the player has an event that changes the attribute bonus again, the data in encumbrance_system.rs is serving the correct status modifiers (inspected in debugger).
It appears that multi-threading is causing the encumbrance system code to execute after the status effect entity is deleted but before the corresponding status effect modifies have been removed from the datastore.
- 主要语言
- Rust
- 星标
- 967
- 派生
- 166
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
amethyst/rustrogueliketutorial 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 1/5 1-3 小时 新手友好度 45/100
查看 amethyst/rustrogueliketutorial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7997 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
smol-machines/smolvm#1489 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复