hive3.X的HiveServer2 内存泄漏问题定位与优化方案(bug)

参考文档:

https://juejin.cn/post/7141331245627080735?searchId=20230920140418F85636A0735C03971F71

官网社区:

https://issues.apache.org/jira/browse/HIVE-22275

In the case that multiple statements are run by a single Session before being cleaned up, it appears that OperationManager.queryIdOperation is not cleaned up properly.

See the log statements below - with the exception of the first "Removed queryId:" log line, the queryId listed during cleanup is the same, when each of these handles should have their own queryId. Looks like only the last queryId executed is being cleaned up.

As a result, HS2 can run out of memory as OperationManager.queryIdOperation grows and never cleans these queryIds/Operations up.

解决

既然找到了问题,那么解决方案就清楚了,那便是将 Query Id 这个值设置成 Operation 级别,而不是 HiveSession 级别,此问题影响 Hive3.x 版本,2.x 暂时没有这个特性,因此不受影响。再对照官方已知的 issue,此问题是已知 issue,目前 Hive 已经将此问题修复,且合入了4.0的版本,

但是由于该 issue 是针对 4.0.0 的代码修复的,对于 3.x 系列并没有 patch,直接 cherry-pick 将会有大量的代码不兼容,因此需要自行参考进行修复,修复的思路为给 Operation 新增:

将 Query Id 从 HiveSession 级别移除,存入 Operation 级别,同时更新 Query Id 的获取和设置:

对 Hive 进行重新打包,在现有集群上对 hive-service-x.x.x.jar 进行替换,即可修复此问题。

相关推荐
阿里云大数据AI技术1 天前
Daft 多模态视频抽帧性能优化实践:从抽帧到大模型打标,一条视频理解流水线是怎么跑起来的
大数据·人工智能·spark
Htr_1 天前
Outcome 核心概念与实战应用指南
大数据·hadoop·apache
隔窗听雨眠1 天前
Library Cache Lock性能故障深度解析:JDBC驱动Bug、绑定变量长度与游标激增的连环效应
bug·library
盗理者2 天前
AI Agent 工程实践|让 AI Agent 自动修 Bug:定位、修改、测试与人工审核
人工智能·bug·agent
程序员AlbertTu2 天前
Linux 系统 Bug 调试操作手册
linux·postgresql·bug
FserSuN2 天前
回顾Spark的概念与应用
大数据·分布式·spark
用户3610588626123 天前
SparkSQL 数据源与底层架构深度剖析
大数据·spark
用户3610588626123 天前
SparkSQL 之 DataFrame 与 DataSet 及实操演练
大数据·spark
BYSJMG3 天前
计算机毕业设计选题推荐|【基于大数据的城市噪音数据可视化分析】Spark+K-Means+FP-Growth实战
大数据·hadoop·信息可视化·spark·课程设计
starzy19903 天前
Spark 核心之 Shuffle 文件寻址详解
大数据·spark