From 5dff08d02b2561ca39d7e569b9870f7a315080f0 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Tue, 16 Jul 2024 22:24:04 +0800
Subject: [PATCH] fix redis coredump when hugetlbs pagesize is 1024M

---
 src/lstack/core/lstack_init.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
index a5a4a4e..629c790 100644
--- a/src/lstack/core/lstack_init.c
+++ b/src/lstack/core/lstack_init.c
@@ -113,8 +113,16 @@ void gazelle_exit(void)
     /* 1: wait until app thread call send functio complete */
     sleep(1);
     stack_group_exit();
+}
 
+void dpdk_exit(void)
+{
     if (!use_ltran()) {
+        int ret = rte_pdump_uninit();
+        if (ret < 0) {
+            LSTACK_LOG(ERR, LSTACK, "rte_pdump_uninit failed\n");
+        }
+
 #if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0)
         dpdk_kni_release();
 #endif
@@ -126,13 +134,7 @@ __attribute__((destructor)) void gazelle_network_exit(void)
     if (posix_api != NULL && !posix_api->use_kernel) {
         lwip_exit();
         gazelle_exit();
-    }
-
-    if (!use_ltran()) {
-        int32_t ret = rte_pdump_uninit();
-        if (ret < 0) {
-            LSTACK_LOG(ERR, LSTACK, "rte_pdump_uninit failed\n");
-        }
+        dpdk_exit();
     }
 }
 
-- 
2.33.0

