Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] lua/utils: fix fiber->fid print in Lua tracing
@ 2021-05-14 10:19 Cyrill Gorcunov via Tarantool-patches
  2021-05-14 10:32 ` [Tarantool-patches] [PATCH v2] lua/utils: fix fiber->fid print in cord_on_yield Cyrill Gorcunov via Tarantool-patches
  0 siblings, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov via Tarantool-patches @ 2021-05-14 10:19 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

This fixes a nit in commit 6af473778
(fiber: use uint64_t for fiber IDs).

Since lua_pushfstring doesn't support %llu format it
breaks the test

app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
branch gorcunov/gh-5846-fid-name-fix

 src/lua/utils.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/lua/utils.c b/src/lua/utils.c
index 0fbe700fc..6e5b6e8e8 100644
--- a/src/lua/utils.c
+++ b/src/lua/utils.c
@@ -1341,6 +1341,7 @@ void cord_on_yield(void)
 	 * code misbehaviour and failures, so stop its execution.
 	 */
 	if (unlikely(tvref(g->jit_base))) {
+		char buf[256];
 		/*
 		 * XXX: mcode is executed only in scope of Lua
 		 * world and one can obtain the corresponding Lua
@@ -1348,10 +1349,12 @@ void cord_on_yield(void)
 		 */
 		struct lua_State *L = fiber()->storage.lua.stack;
 		assert(L != NULL);
-		lua_pushfstring(L, "fiber %llu is switched while running the"
-				" compiled code (it's likely a function with"
-				" a yield underneath called via LuaJIT FFI)",
-				(long long)fiber()->fid);
+		snprintf(buf, sizeof(buf),
+			 "fiber %llu is switched while running the"
+			 " compiled code (it's likely a function with"
+			 " a yield underneath called via LuaJIT FFI)",
+			 (long long)fiber()->fid);
+		lua_pushstring(L, buf);
 		if (g->panic)
 			g->panic(L);
 		exit(EXIT_FAILURE);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-17  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 10:19 [Tarantool-patches] [PATCH] lua/utils: fix fiber->fid print in Lua tracing Cyrill Gorcunov via Tarantool-patches
2021-05-14 10:32 ` [Tarantool-patches] [PATCH v2] lua/utils: fix fiber->fid print in cord_on_yield Cyrill Gorcunov via Tarantool-patches
2021-05-14 10:41   ` Igor Munkin via Tarantool-patches
2021-05-14 12:15     ` [Tarantool-patches] [PATCH v3] " Cyrill Gorcunov via Tarantool-patches
2021-05-17  7:36       ` Igor Munkin via Tarantool-patches
2021-05-17  8:22       ` Igor Munkin via Tarantool-patches
2021-05-17  8:22       ` Alexander V. Tikhonov via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox