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 进行替换,即可修复此问题。

相关推荐
Kainy5 小时前
Agent派单系统架构拆解:不用消息队列的长轮询设计如何实现手机远程派活修bug
系统架构·bug
FYKJ_201016 小时前
springboot众创项目团队管理系统94666-计算机课程设计、毕业设计
java·vue.js·spring boot·后端·python·spark·课程设计
Lansonli2 天前
大数据Spark(九十五):Spark Shuffle 参数调优全解析
大数据·分布式·spark
Nefu_lyh3 天前
【Spark】05Spark 数据读取与保存:文件格式、文件系统与结构化数据
大数据·分布式·spark
skywalk81633 天前
lightharness第一次大规模开hive任务卡成功
人工智能·hive·agent·deepseek·lightharness
大今野3 天前
2026 专转本计算机|大数据关键技术:Hadoop、MapReduce、NoSQL 与处理流程(附例题)
大数据·hadoop·mapreduce·专转本
SeanQhl4 天前
鲲鹏开发套件综合实战
hadoop·性能调优·openeuler·鲲鹏devkit·应用迁移
丘山录4 天前
本地部署 DGX Spark,200G 网卡挂在 4 条通道上
服务器·人工智能·spark·持续部署
starzy19904 天前
Structured Streaming Kafka Sink:写出一条生产级的回流链路
大数据·分布式·spark·kafka
崖边看雾4 天前
Hive 手册:建表、分区、查询与调优实战指南
数据仓库·hive·hadoop