fix(core): 修复异步任务与资源生命周期#704
Open
zhibeigg wants to merge 1 commit into
Open
Conversation
确保 Future 异常可观察,消除递归删除死锁并可靠关闭文件监听与加载资源。
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.
原有问题
核心异步与资源工具中存在多条“任务已经失败,但调用方永远等不到终态”的路径:
SyncExecutor包装的平台任务一旦抛出异常,异常只会逃逸到调度器,返回的CompletableFuture不会成功也不会异常完成。Throttle的首次调用、零延迟参数以及完整Int随机区间存在边界计算错误。典型触发场景与后果
本 PR 修改
completeExceptionally收敛;成功、失败和取消都只能完成一次。Int随机区间计算。修改目的
确保基础工具在成功、异常、取消和关闭路径上都能得到确定终态,避免永久等待、线程泄漏、文件句柄泄漏和边界输入错误向上层模块扩散。
兼容性与行为变化
deepDeleteAsync的futures集合记录整棵树对应的根任务,不再暴露内部递归子任务。验证
./gradlew :common:build :common-env:build :common-util:build :common-platform-api:build :common-legacy-api:build --rerun-tasks --no-parallel./gradlew :common:test :common-env:build :common-util:test :common-platform-api:test :common-legacy-api:test --rerun-tasks --no-parallelgit diff --checkRefs #703