Hadoop: fix background task thread leak #5363
Merged
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.
BgTaskUtil:
对于同一个 volname 的后台任务只会启动一个实例运行。BgTaskUtil 的 runningInstance 存储了每个 volname 和 handles 之间的映射,当同一个 volname 的所有实例全部关闭,即 BgTaskUtil 内 volname 没有任何 handle 时,清理该 volname 对应的所有后台任务。确保当所有 JuiceFileSystem instance 关闭时,没有线程泄漏。
juicefs.users 和 juicefs.groups 配置的全局 guid 映射会缓存在 main.go 的
userGroupCache // name -> (user -> groups)
里,每个实例 user 的 groups 会优先查询此 map,如果没有找到,才会使用 java 传入的 group。Java 端后台任务会定期更新userGroupCache,默认 1 分钟一次