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 8EB2B6EC56; Thu, 18 Mar 2021 03:03:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8EB2B6EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616025786; bh=WZh/Ldoe8HGg9taREkJq/nvH50+IxvTCp3gjA2K2ytQ=; 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=Y/X2VeL9cv4j92NmeF0OxTq+76vwLGsqaGes/8FmJZajRjJK9KJyfQ8zIeFm64AqT BFAw984pE3YstvQs0N75kNdzWrbdn72cJKBzoeWmA2IAgXzstkhvo+oWdFIRn7xzL0 FXWWvvwRt0Vrgz4mRdGsTq9CGDqDvSvejVWj9A1o= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 30C8F6EC6F for ; Thu, 18 Mar 2021 03:02:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 30C8F6EC6F Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lMg75-0006fv-Bm; Thu, 18 Mar 2021 03:02:07 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Thu, 18 Mar 2021 01:02:04 +0100 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD96485A7A9FC13189308141E2FC47CA41C9FDB0C4C5D9A2558182A05F53808504009047834A622B306450A4CA4CDC270502B09874E7F35D1214234B1F9F231FC3F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE795530B80AF2ADB7BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063750DEB490C003C9A78638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CF89CA98302ED496F7D0F4BE03A63EA57AF22536DA635B73BA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7328B01A8D746D8839FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C327ED053E960B195E117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C224982BBBAF5DF00056E089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7C24C67D5DB94550AF43847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148F90DBEB212AEC08F22623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20BB63DED767380FDF6D756FE5AB1410EFA X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CF89CA98302ED496F7D0F4BE03A63EA57AF22536DA635B73B9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34951738D4D62E58A4F9BB909B3124737B0365AD6395F0F1DA06E38824A73B6AA794E16926B84319F31D7E09C32AA3244C5BCD360BCBC2CE838D7C3DFAA718125E3E8609A02908F271FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojBN5tWX4G0Zxmc3qMiPPi6w== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638229BC52FCF4EA8A6E7CF3301688925D8FC3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 2/2] lua: separate sched and script diag 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" When Lua main script was launched, the sched fiber passed its own diag to the script's fiber. When the script was finished, it put its error into the diag. The sched fiber then checked if the diag is empty to detect an error. But it wasn't really correct. The error could also happen right in the scheduler fiber in a libev callback. For example, in one of ev_io callbacks in SWIM. Then the process would end with an error even if the script was finished successfully. These errors were not related to the main fiber executing the script. The patch makes so the scheduler fiber's diag no longer is used as an indication of an error in the script. Instead, a new diag is created on the stack of the scheduler's fiber, where the Lua script saves the error. Closes #5906 --- changelogs/unreleased/swim-broadcast-error.md | 6 ++++++ src/lua/init.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/swim-broadcast-error.md diff --git a/changelogs/unreleased/swim-broadcast-error.md b/changelogs/unreleased/swim-broadcast-error.md new file mode 100644 index 000000000..19ad44ca2 --- /dev/null +++ b/changelogs/unreleased/swim-broadcast-error.md @@ -0,0 +1,6 @@ +## bugfix/swim + +* Fix `:broadcast()` which does not work on non-local addresses + and spams "Permission denied" errors to the log. Also after instance + termination it could return a non-0 exit code even if there was no errors in + the script, and spam the error again (gh-5864). diff --git a/src/lua/init.c b/src/lua/init.c index 4729ad7a2..767abdfc5 100644 --- a/src/lua/init.c +++ b/src/lua/init.c @@ -718,8 +718,16 @@ tarantool_lua_run_script(char *path, bool interactive, if (script_fiber == NULL) panic("%s", diag_last_error(diag_get())->errmsg); script_fiber->storage.lua.stack = tarantool_L; + /* + * Create a new diag on the stack. Don't pass fiber's diag, because it + * might be overwritten by libev callbacks invoked in the scheduler + * fiber (which is this), and therefore can't be used as a sign of fail + * in the script itself. + */ + struct diag script_diag; + diag_create(&script_diag); fiber_start(script_fiber, tarantool_L, path, interactive, - optc, optv, argc, argv, diag_get()); + optc, optv, argc, argv, &script_diag); /* * Run an auxiliary event loop to re-schedule run_script fiber. @@ -729,6 +737,8 @@ tarantool_lua_run_script(char *path, bool interactive, ev_run(loop(), 0); /* The fiber running the startup script has ended. */ script_fiber = NULL; + diag_move(&script_diag, diag_get()); + diag_destroy(&script_diag); /* * Result can't be obtained via fiber_join - script fiber * never dies if os.exit() was called. This is why diag -- 2.24.3 (Apple Git-128)