From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5C9306EC56; Fri, 23 Jul 2021 14:08:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5C9306EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627038513; bh=rLMBMpPnHY7ekv0LkhTbN8j1Kb+L0BZroLiZx7jDaYQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yP/K5F0ly7WVGxE7rH4hUHZPF3u50YpojfMnFcw4fzMtojncRBMBPoh9ZiSdj+vxN ssDM0h/qWxZA8Y032ysSjY9I7V4ABbb1YA8CWre7VdWmIXcuFUOK7GbIDpkAGm8DE1 fUvwFiY/+mtsc72yRanYvMvHMmaqg8nloBe5RPLw= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 43CEF6EC56 for ; Fri, 23 Jul 2021 14:07:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 43CEF6EC56 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1m6t1f-0004dl-Oh; Fri, 23 Jul 2021 14:07:32 +0300 To: tarantool-patches@dev.tarantool.org Date: Fri, 23 Jul 2021 14:07:12 +0300 Message-Id: <65aeb09c8164eda4e5bab1c0c0a153096e5ecdd0.1627024646.git.vdavydov@tarantool.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-174C08C4: 5188C02AEC42908C481ED7ADC579193296BBA28369E3F2D2713F3D5F7D406D31BCF678C7329BA986 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3D3726AD0AC8C7907896201F0AD2BBAE8182A05F538085040E6D6B52C12C6FF14D649F2A065E3C75D7FB3AA2DDA648B59FB5A0B6A008B5A42 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C4C5A4C22B203AA8EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063768D6DD405B71470F8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D860A946F6D24CF5F487AB35D8EA9D0E7E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209ECD01F8117BC8BEA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CB1724D34C644744043847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 8BD88D57C5CADBC8B2710865C3867510A0B4543D0F65078DA3B1A56EE2B804F6B226C914C996894645FD9D8A29397D6EFF55FE49A3C2BFCFC8C84E951CD0BE2F296C473AB1E14218EA052B563B0B06C67866D6147AF826D860A946F6D24CF5F487AB35D8EA9D0E7EF972CCD2F8FE1EF1CFC4036BBF6A4EA9B4168439BA9D9B6ACB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F8A2DF183797A6A86550D2395DD0DED88CCA116E5A82CA66790D926B2D9F9F112A88E517BE3E431C1D7E09C32AA3244C9D57DDA523323038831B3F7F718C79FCC86C126E7119A0FE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiEX0g4jkpDtS4KJeaOGTUi X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D9405F6FD1092D34AD2F27BEFC676A23D274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 02/20] net.box: wake up wait_result callers when request is discarded X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" request.discard() doesn't wake up fibers blocked in request.wait_result() as a result they hang until timeout. Fix this and add a test. --- src/box/lua/net_box.lua | 1 + test/box/net.box_discard_gh-3107.result | 11 +++++++++++ test/box/net.box_discard_gh-3107.test.lua | 3 +++ 3 files changed, 15 insertions(+) diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index 5fd8b96b079d..cacb7473deb0 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -432,6 +432,7 @@ local function create_transport(host, port, user, password, callback, self.id = nil self.errno = box.error.PROC_LUA self.response = 'Response is discarded' + self.cond:broadcast() end end diff --git a/test/box/net.box_discard_gh-3107.result b/test/box/net.box_discard_gh-3107.result index 3498c9d5a9be..370a87c524b4 100644 --- a/test/box/net.box_discard_gh-3107.result +++ b/test/box/net.box_discard_gh-3107.result @@ -92,9 +92,20 @@ ret future = c:call('long_function', {1, 2, 3}, {is_async = true}) --- ... +ch = fiber.channel() +--- +... +_ = fiber.create(function() ch:put({future:wait_result()}) end) +--- +... future:discard() --- ... +ch:get(100) +--- +- - null + - Response is discarded +... finalize_long() --- ... diff --git a/test/box/net.box_discard_gh-3107.test.lua b/test/box/net.box_discard_gh-3107.test.lua index 71f08a411422..89f177fa811f 100644 --- a/test/box/net.box_discard_gh-3107.test.lua +++ b/test/box/net.box_discard_gh-3107.test.lua @@ -33,7 +33,10 @@ ret -- Test discard. -- future = c:call('long_function', {1, 2, 3}, {is_async = true}) +ch = fiber.channel() +_ = fiber.create(function() ch:put({future:wait_result()}) end) future:discard() +ch:get(100) finalize_long() future:result() future:wait_result(100) -- 2.25.1