fix(kether): 修复异步上下文完成与线程切换#706
Open
zhibeigg wants to merge 1 commit into
Open
Conversation
确保动作异常与取消能够结束上下文并回收运行任务,同时序列化远程读取并将计分板更新切回平台线程。
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
原有问题
Kether 异步上下文在异常、取消和线程切换方面存在三类问题:
RemoteQuestReader的读取游标和反射状态可被多个线程同时访问,缺少串行化保护。典型触发场景与后果
本 PR 修改
AbstractQuestContext中统一传播动作的同步异常、异步异常和取消,并停止后续动作、反向取消仍在运行的 Future。RemoteQuestReader的反射读取状态,避免共享游标竞态。修改目的
保证 Kether 脚本无论成功、失败还是取消都能可靠结束,同时遵守 Bukkit/Folia 的线程所有权要求,避免脚本挂死和跨线程平台访问。
兼容性与行为变化
验证
./gradlew :module:minecraft:minecraft-kether:test --rerun-tasks --no-parallel./gradlew :module:minecraft:minecraft-kether:build --rerun-tasks --no-parallelgit diff --checkRefs #703