From caf2482af359e89018cf6fa1a3f63e88f0240c98 Mon Sep 17 00:00:00 2001 From: Tiewei Fang Date: Sun, 17 Nov 2024 19:48:49 +0800 Subject: [PATCH] [fix](Export) fix a memory leak in the FE because of the ExportJob (#44019) ### What problem does this PR solve? Problem Summary: When an `Export` job has finished or been cancelled, `ExportMgr` will maintain a reference of the `ExportJob` object. Therefore, we need to clear these no longer used objects; otherwise it will cause a memory leak in the FE. --- .../src/main/java/org/apache/doris/load/ExportJob.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java index 98cfb443ec810b..554185a2ed677d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java @@ -703,6 +703,9 @@ private void cancelExportJobUnprotected(ExportFailMsg.CancelType type, String ms finishTimeMs = System.currentTimeMillis(); failMsg = new ExportFailMsg(type, msg); jobExecutorList.clear(); + selectStmtListPerParallel.clear(); + allOutfileInfo.clear(); + partitionToVersion.clear(); if (FeConstants.runningUnitTest) { return; } @@ -750,6 +753,9 @@ private void finishExportJobUnprotected() { outfileInfo = GsonUtils.GSON.toJson(allOutfileInfo); // Clear the jobExecutorList to release memory. jobExecutorList.clear(); + selectStmtListPerParallel.clear(); + allOutfileInfo.clear(); + partitionToVersion.clear(); Env.getCurrentEnv().getEditLog().logExportUpdateState(this, ExportJobState.FINISHED); LOG.info("finish export job {}", id); }