Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v2 3/3] lua: expose temporary Lua state for iproto calls
Date: Fri, 17 Jul 2020 06:09:59 +0300	[thread overview]
Message-ID: <20200717030959.b4jrn3aq7krpe44h@tkn_work_nb> (raw)
In-Reply-To: <20200716223306.GC18920@tarantool.org>

> > > Are those conditions below are strictly required by the current
> > > implementation?
> > 
> > When the fiber-local Lua state is present it should not be changed or
> > zapped by the function. I don't know whether it would lead to some
> > negative behaviour changes, but it would be at least counter-intuitive.
> > There is the comment on the topic (I left it cited below).
> 
> My last sentence relates to the check whether fiber-local Lua state is
> present. Long story short, I see no reasons to omit this field
> initialization prior to <box_process_lua> call. Feel free to consider
> this one as a side note with no changes required.

Igor clarified his idea in the offline discussion. Now box_process_lua()
always creates a new Lua thread to serve a call request, but it may
reuse the fiber-local Lua state when it exists. Similarly how
lbox_trigger_run() either use the existing state or create a new one
(see [1]).

The idea looks meaningful. I experimented around and got failed
sql/boolean.test.sql test. It seems I unable to provide a ready patch at
the time: at least I need to debug and polish it, think how to test it,
at max I should look on reusing a Lua state at whole and elaborate
possible approaches.

I think we can proceed with the current 'lua: expose temporary Lua state
for iproto calls' patch, which prevents twice creation of a Lua thread
for background fibers when merger is used or a trigger is run. And then
work on preventing twice creation of a thread for Lua-born fibers (say,
when <box.schema.func.call> is used). Usage of this function is quite
rare, I guess.

[1]: https://github.com/tarantool/tarantool/commit/7d0408486571c631e796a90a35adae41cfcd53c9

  reply	other threads:[~2020-07-17  3:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 21:06 [Tarantool-patches] [PATCH v2 0/3] Merger's NULL defererence Alexander Turenko
2020-06-17 21:06 ` [Tarantool-patches] [PATCH v2 1/3] merger: fix NULL dereference when called via iproto Alexander Turenko
2020-06-18 22:48   ` Vladislav Shpilevoy
2020-06-19  8:50     ` Alexander Turenko
2020-06-19 23:32   ` Vladislav Shpilevoy
2020-06-21 18:28     ` Alexander Turenko
2020-07-01 20:36   ` Igor Munkin
2020-07-16 20:10     ` Alexander Turenko
2020-07-16 21:42       ` Igor Munkin
2020-07-16 22:44         ` Igor Munkin
2020-07-17  3:08         ` Alexander Turenko
2020-06-17 21:06 ` [Tarantool-patches] [PATCH v2 2/3] merger: clean fiber-local Lua stack after next() Alexander Turenko
2020-06-19  8:50   ` Alexander Turenko
2020-07-01 20:36   ` Igor Munkin
2020-07-16 20:11     ` Alexander Turenko
2020-07-16 22:07       ` Igor Munkin
2020-07-17  3:08         ` Alexander Turenko
2020-06-17 21:06 ` [Tarantool-patches] [PATCH v2 3/3] lua: expose temporary Lua state for iproto calls Alexander Turenko
2020-07-01 20:37   ` Igor Munkin
2020-07-16 20:11     ` Alexander Turenko
2020-07-16 22:33       ` Igor Munkin
2020-07-17  3:09         ` Alexander Turenko [this message]
2020-06-22 20:38 ` [Tarantool-patches] [PATCH v2 0/3] Merger's NULL defererence Vladislav Shpilevoy
2020-07-17 11:28 ` Alexander Turenko

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=20200717030959.b4jrn3aq7krpe44h@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 3/3] lua: expose temporary Lua state for iproto calls' \
    /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