From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Georgy Kirichenko <georgy@tarantool.org>, tarantool-patches@dev.tarantool.org, korablev@tarantool.org, imun@tarantool.org Subject: Re: [Tarantool-patches] [PATCH 1/1] fio: close unused descriptors automatically Date: Mon, 10 Feb 2020 20:36:55 +0100 [thread overview] Message-ID: <57757b6b-559a-f330-e7c9-7d8e99161533@tarantool.org> (raw) In-Reply-To: <4600369.31r3eYUQgx@localhost> Hi! Thanks for your review! On 09/02/2020 19:34, Georgy Kirichenko wrote: > Hi, thanks for the patch. > > Unfortunately your patch is not correct because fiber.create > yields (which could be fixed by using fiber.new) and raises an error what is not > allowed inside gc callbacks. Good catch! ================================================================================ -- FFI GC can't yield. Internal.close() yields. -- Collect the garbage later, in a separate fiber. - fiber.create(internal.close, fh) + fiber.new(internal.close, fh) end) }, fio_mt) ================================================================================ > From my point of view the possible approach is a dedicated fiber with > a list of pending callbacks. Yes, I was thinking about this as well, but thought it would be an overkill just for fio. Since you also propose this solution, I suggest to do it separately, and for other modules too. We could introduce a new module 'background', or 'gc', or 'worker', or 'pool' which would provide API like 'execute(func, arg)'. And it would call it in a special global fiber. Example: pool = require('pool') pool.execute(internal.close, fd) So basically we could reinvent fiber pool for Lua. This can be used for fio and SWIM objects GC, because SWIM currently also creates a new fiber in its GC callback. Also this could be implemented as a submodule of fiber module. For instance, fiber.pool.execute().
next prev parent reply other threads:[~2020-02-10 19:36 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-09 17:37 Vladislav Shpilevoy 2020-02-09 17:38 ` Vladislav Shpilevoy 2020-02-09 18:34 ` Georgy Kirichenko 2020-02-10 19:36 ` Vladislav Shpilevoy [this message] 2020-03-02 20:51 ` Vladislav Shpilevoy 2020-02-09 19:25 ` Konstantin Osipov 2020-02-10 6:31 ` Kirill Yukhin 2020-02-10 8:20 ` Cyrill Gorcunov 2020-02-10 8:21 ` Cyrill Gorcunov 2020-02-10 19:36 ` Vladislav Shpilevoy 2020-02-14 11:48 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=57757b6b-559a-f330-e7c9-7d8e99161533@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=georgy@tarantool.org \ --cc=imun@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 1/1] fio: close unused descriptors automatically' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox