1From 0d5070b4a40912a7921e0101461a9c7d61919acd Mon Sep 17 00:00:00 2001 2From: HuangLiming <huangliming5@huawei.com> 3Date: Tue, 25 May 2021 03:08:33 -0400 4Subject: [PATCH] fix the occasional coredump when the lwip exits 5 6Signed-off-by: HuangLiming <huangliming5@huawei.com> 7--- 8 src/api/sockets.c | 37 +++++++++---------------------------- 9 1 file changed, 9 insertions(+), 28 deletions(-) 10 11diff --git a/src/api/sockets.c b/src/api/sockets.c 12index d62e55b..658f762 100644 13--- a/src/api/sockets.c 14+++ b/src/api/sockets.c 15@@ -4655,36 +4655,17 @@ void lwip_sock_init(void) 16 return; 17 } 18 19-//modify from lwip_close 20 void lwip_exit(void) 21 { 22- int i, is_tcp; 23- struct lwip_sock *sock; 24- 25- if (memp_pools[MEMP_SYS_MBOX] == NULL) { 26- return; 27- } 28- 29- for (i = 0; i < sockets_num; i++) { 30- sock = &sockets[i]; 31- if (!sock->conn) 32- continue; 33-#if LWIP_IGMP 34- /* drop all possibly joined IGMP memberships */ 35- lwip_socket_drop_registered_memberships(i); 36-#endif /* LWIP_IGMP */ 37- /* 38- * process is exiting, call netconn_delete to 39- * close tcp connection, and ignore the return value 40- */ 41- is_tcp = NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP; 42- netconn_delete(sock->conn); 43- free_socket(sock, is_tcp); 44- } 45- 46- free(sockets); 47- sockets = NULL; 48- sockets_num = 0; 49+ /* 50+ * LwIP has the following two parts of memory application, but 51+ * it is unnecessary to release all memory in sequentially, 52+ * which increases complexity. Therefore, we rely on the process 53+ * reclamation mechanism of the system to release memory. 54+ * 1. a sockets table of the process. 55+ * 2. a batch of hugepage memory of each thread. 56+ */ 57+ return; 58 } 59 60 #endif /* USE_LIBOS */ 61-- 622.23.0 63 64