lwip/0003-fix-the-occasional-coredump-when-the-lwip-exits.patch
2022-01-18 10:45:28 +08:00

64 lines
1.7 KiB
Diff

From 0d5070b4a40912a7921e0101461a9c7d61919acd Mon Sep 17 00:00:00 2001
From: HuangLiming <huangliming5@huawei.com>
Date: Tue, 25 May 2021 03:08:33 -0400
Subject: [PATCH] fix the occasional coredump when the lwip exits
Signed-off-by: HuangLiming <huangliming5@huawei.com>
---
src/api/sockets.c | 37 +++++++++----------------------------
1 file changed, 9 insertions(+), 28 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index d62e55b..658f762 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4655,36 +4655,17 @@ void lwip_sock_init(void)
return;
}
-//modify from lwip_close
void lwip_exit(void)
{
- int i, is_tcp;
- struct lwip_sock *sock;
-
- if (memp_pools[MEMP_SYS_MBOX] == NULL) {
- return;
- }
-
- for (i = 0; i < sockets_num; i++) {
- sock = &sockets[i];
- if (!sock->conn)
- continue;
-#if LWIP_IGMP
- /* drop all possibly joined IGMP memberships */
- lwip_socket_drop_registered_memberships(i);
-#endif /* LWIP_IGMP */
- /*
- * process is exiting, call netconn_delete to
- * close tcp connection, and ignore the return value
- */
- is_tcp = NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP;
- netconn_delete(sock->conn);
- free_socket(sock, is_tcp);
- }
-
- free(sockets);
- sockets = NULL;
- sockets_num = 0;
+ /*
+ * LwIP has the following two parts of memory application, but
+ * it is unnecessary to release all memory in sequentially,
+ * which increases complexity. Therefore, we rely on the process
+ * reclamation mechanism of the system to release memory.
+ * 1. a sockets table of the process.
+ * 2. a batch of hugepage memory of each thread.
+ */
+ return;
}
#endif /* USE_LIBOS */
--
2.23.0