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

相关推荐
无人赴约的cat5 小时前
【20250607接单】Spark + Scala + IntelliJ 项目的开发环境配置从零教学
大数据·spark·scala
£菜鸟也有梦5 小时前
Flume进阶之路:从基础到高阶的飞跃
大数据·hive·hadoop·flume
zh_1999510 小时前
Spark 之 入门讲解详细版(1)
大数据·spark·mapreduce·数据库架构·etl·涛思数据·odps
qq_4639448613 小时前
【Spark征服之路-2.5-Spark-Core编程(一)】
大数据·分布式·spark
下雨不打伞码农13 小时前
mkdir: Cannot create directory /spark/jars. Name node is in safe mode
大数据·分布式·spark
小伍_Five14 小时前
spark数据处理练习题番外篇【上】
java·大数据·spark·scala
Detachym14 小时前
CentOS下的分布式内存计算Spark环境部署
分布式·spark·centos
Kookoos15 小时前
ABP vNext + Hive 集成:多租户大数据 SQL 查询与报表分析
大数据·hive·sql·.net·abp vnext
银色的白16 小时前
开发记录:修复一些Bug,并实现两个功能
bug