From 45b407481d5a9f9abcf3504ddb07549c08a33313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BB=94?= <41766775+huahua132@users.noreply.github.com> Date: Fri, 17 May 2024 12:26:42 +0800 Subject: [PATCH] fix socketchannel mem leakage (#1921) --- lualib/skynet/socketchannel.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lualib/skynet/socketchannel.lua b/lualib/skynet/socketchannel.lua index 871334c2..24e8de75 100644 --- a/lualib/skynet/socketchannel.lua +++ b/lualib/skynet/socketchannel.lua @@ -60,6 +60,10 @@ local function close_channel_socket(self) if self.__sock then local so = self.__sock self.__sock = false + if self.__wait_response then + skynet.wakeup(self.__wait_response) + self.__wait_response = nil + end -- never raise error pcall(socket.close,so[1]) end @@ -128,7 +132,7 @@ local function dispatch_by_session(self) end local function pop_response(self) - while true do + while self.__sock do local func,co = table.remove(self.__request, 1), table.remove(self.__thread, 1) if func then return func, co