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 210CC6FC86; Mon, 22 Mar 2021 20:17:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 210CC6FC86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616433428; bh=kdxw5O8DH4yPzBCgCKGuxHfFr3Pjl6loTWLmrXLGTw0=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=O4Rl10u4Ekd/0t0vJGbJ1iqyqw/+J8A04Qh0nqfjTXIHEBMXxYos5cJ94K4yGfS8m xOuJy9/t7A8M6ULCi5S4XYKQN88eLrY+alB/RI9Vdno4f59tWqQpZ+5yrGEyAMv5Kp 8v3iW4eJkvfZiFpAXWoh9r9iNpyHLOR7Z2YVslMA= Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 8DB686FC86 for ; Mon, 22 Mar 2021 20:17:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8DB686FC86 Received: by smtp50.i.mail.ru with esmtpa (envelope-from ) id 1lOOAr-0006xJ-Rd; Mon, 22 Mar 2021 20:17:06 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com References: Message-ID: <0bfcb80a-438b-5064-7094-316f9069fb8c@tarantool.org> Date: Mon, 22 Mar 2021 20:17:05 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95D6E7CC48CB1F5F10D3016C09B407F8B88411E9FEB481E8E182A05F538085040C38488F2154D509E2780A77E4A93DEF88AA17E783DEB60E317B244C1AE30F348 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE728A881FD0F09D355EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CA870F47FB69F4AC8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C686AF563A045C75E0353607789E9F5D16C073AA6B7A68C78A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C353FA85A707D24CADCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E34F43C7A68FF626056395957E7521B51C2D96E472CDF7238E04AD6D5ED66289B5278DA827A17800CE70AD1028CF10412FC93EC92FD9297F6715571747095F342E857739F23D657EF2BD5E8D9A59859A8B641D154D92C01BDF175ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC85D9B7C4F32B44FF57285124B2A10EEC6C00306258E7E6ABB4E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5A4EFFA46B22F34F2746F1D0662481C5E9BA34FA4E61DF2D2D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348B409C2D257583DFC749B9D38048BBD67CDACDD6D89270744FD76B9A63181AA693FD11C9D52B86A01D7E09C32AA3244C80A6B81A5AC3C1AE122F876BFF413BEBD9ADFF0C0BDB8D1FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWJZv20R+6UgEFjHp4EhVPQ== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A4467978FCA47CC18718FF36C8D7123F0CC90A224D6C2D12490E424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 00/16] Cord buffer, static alloc, and Lua GC bug 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 20.03.2021 03:42, Vladislav Shpilevoy пишет: > The patch attempts to fix most of the easy to face issues with the global > resources not having proper ownership in Lua code and therefore not protected > again being suddenly reused during Lua GC. > > There are many such resources: tarantool_lua_ibuf/IBUF_SHARED, static alloc, > errno, diag/box.error, box_tuple_last, port_c, and others. > > The most easy to screw - ibuf and static alloc. They are fixed in this > patchset. > > The solution is dubious, but there were not found any better alternatives. > > A patch for 1.10 will be sent later in a separate CL. > > Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-5632-global-buf-crash-2x > Issue: https://github.com/tarantool/tarantool/issues/5632 Hi! Thanks for the patchset! Generally LGTM, with one question in reply to patch 06. > > Vladislav Shpilevoy (16): > fio: don't use shared buffer in pread() > test: don't use IBUF_SHARED in the tests > tuple: pass global ibuf explicitly where possible > iconv: take errno before reseting the context > cord_buf: introduce cord_buf API > cord_buf: introduce ownership management > buffer: implement ffi stash > uuid: replace static_alloc with ffi stash > uuid: drop tt_uuid_str() from Lua > uri: replace static_alloc with ffi stash and ibuf > buffer: remove static_alloc() from Lua > lua: use lua_pushfstring() instead of tt_sprintf() > sio: rework sio_strfaddr() > sio: increase SERVICE_NAME_MAXLEN size > sio: introduce and use sio_snprintf() > buffer: remove Lua registers > > changelogs/unreleased/fix-ibuf-static.md | 7 + > src/CMakeLists.txt | 1 - > src/box/iproto.cc | 8 +- > src/box/iproto.h | 2 +- > src/box/lua/info.c | 5 +- > src/box/lua/net_box.lua | 4 +- > src/box/lua/schema.lua | 56 ++++-- > src/box/lua/session.c | 7 +- > src/box/lua/space.cc | 6 +- > src/box/lua/tuple.c | 80 +++++---- > src/box/lua/tuple.lua | 14 +- > src/exports.h | 7 +- > src/lib/core/CMakeLists.txt | 1 + > src/lib/core/cord_buf.c | 167 ++++++++++++++++++ > src/lib/core/cord_buf.h | 54 ++++++ > src/lib/core/sio.c | 72 ++++---- > src/lib/core/sio.h | 15 +- > src/lua/buffer.c | 42 ----- > src/lua/buffer.lua | 156 +++++++++------- > src/lua/crypto.lua | 19 +- > src/lua/digest.lua | 25 ++- > src/lua/fiber.c | 2 +- > src/lua/fio.lua | 12 +- > src/lua/iconv.lua | 27 +-- > src/lua/init.c | 3 - > src/lua/msgpack.c | 6 +- > src/lua/msgpackffi.lua | 57 +++--- > src/lua/socket.lua | 54 +++--- > src/lua/string.lua | 26 ++- > src/lua/swim.lua | 19 +- > src/lua/uri.lua | 21 ++- > src/lua/utf8.c | 21 ++- > src/lua/utils.h | 1 - > src/lua/uuid.lua | 115 +++++++----- > .../test/static-build/exports.test.lua | 4 +- > test/app-tap/buffer.test.lua | 59 +++++++ > test/app-tap/gh-5632-gc-buf-reuse.test.lua | 151 ++++++++++++++++ > test/app-tap/module_api.test.lua | 10 +- > test/app-tap/uri.test.lua | 23 +-- > test/app/buffer.result | 53 ------ > test/app/buffer.test.lua | 23 --- > test/app/fio.result | 160 +++++++++-------- > test/app/fio.test.lua | 67 ++++--- > test/app/msgpack.result | 7 +- > test/app/msgpack.test.lua | 5 +- > test/box/varbinary_type.result | 3 +- > test/box/varbinary_type.test.lua | 3 +- > test/unit/luaT_tuple_new.c | 4 - > 48 files changed, 1092 insertions(+), 592 deletions(-) > create mode 100644 changelogs/unreleased/fix-ibuf-static.md > create mode 100644 src/lib/core/cord_buf.c > create mode 100644 src/lib/core/cord_buf.h > delete mode 100644 src/lua/buffer.c > create mode 100755 test/app-tap/buffer.test.lua > create mode 100755 test/app-tap/gh-5632-gc-buf-reuse.test.lua > delete mode 100644 test/app/buffer.result > delete mode 100644 test/app/buffer.test.lua > -- Serge Petrenko