Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja.osipov@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/3] fiber: destroy fiber.storage created by iproto
Date: Mon, 20 Jan 2020 10:22:34 +0300	[thread overview]
Message-ID: <20200120072234.GB19835@atlas> (raw)
In-Reply-To: <b305ecda-17d3-5af3-2a60-90020e08fe57@tarantool.org>

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/01/20 09:59]:
> > Why did you have to add so many invocation points to
> > fiber_on_stop() rather than simply adding fiber_on_stop invocation to
> > fiber_pool.c?
> 
> We already discussed that in the previous patch version. We decided
> to move cleanup to iproto.cc, because it depends on when a request
> ends. Fiber pool knows nothing about requests. Iproto.cc is request
> processing layer, and this is the right place for request data
> destruction.

True, but since you abstracted out the destruction via an opaque
trigger, why not move the invocation of the trigger to fiber pool? 
fiber pool has most knowledge about fiber life cycle, so it seems
natural to invoke the triggers in it - it will tie the *timing* to
fiber pool, but not what's going on inside the trigger.

Thoughts?
> > I would move this !rlist_empty check to fiber_on_stop and add a
> > comment why we explicitly check for the list first.
> 
> I doubt it really helps, but ok.
> 
> ================================================================================
> 
> diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
> index 634b3d1b0..354749549 100644
> --- a/src/lib/core/fiber.c
> +++ b/src/lib/core/fiber.c
> @@ -328,6 +328,12 @@ fiber_attr_getstacksize(struct fiber_attr *fiber_attr)
>  void
>  fiber_on_stop(struct fiber *f)
>  {
> +	/*
> +	 * The most common case is when the list is empty. Do an
> +	 * inlined check before calling trigger_run().
> +	 */
> +	if (rlist_empty(&f->on_stop))
> +		return;
>  	if (trigger_run(&f->on_stop, f) != 0)
>  		panic("On_stop triggers can't fail");
>  	/*

thanks!

-- 
Konstantin Osipov, Moscow, Russia

  reply	other threads:[~2020-01-20  7:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 21:54 [Tarantool-patches] [PATCH v2 0/3] Fiber storage leak Vladislav Shpilevoy
2020-01-16 21:54 ` [Tarantool-patches] [PATCH v2 1/3] fiber: unref fiber.storage via global Lua state Vladislav Shpilevoy
2020-01-17  7:30   ` Konstantin Osipov
2020-01-16 21:54 ` [Tarantool-patches] [PATCH v2 2/3] fiber: destroy fiber.storage created by iproto Vladislav Shpilevoy
2020-01-16 22:00   ` Cyrill Gorcunov
2020-01-17  7:47     ` Konstantin Osipov
2020-01-17  8:06       ` Cyrill Gorcunov
2020-01-17  7:45   ` Konstantin Osipov
2020-01-19 17:32     ` Vladislav Shpilevoy
2020-01-20  7:22       ` Konstantin Osipov [this message]
2020-01-20 19:15         ` Georgy Kirichenko
2020-01-21 22:21         ` Vladislav Shpilevoy
2020-01-21 22:32           ` Konstantin Osipov
2020-01-16 21:54 ` [Tarantool-patches] [PATCH v2 3/3] box: remove dead code from box_process_call/eval() Vladislav Shpilevoy
2020-01-17  7:46   ` Konstantin Osipov
2020-01-17  7:47   ` Konstantin Osipov
2020-01-17 17:41   ` Georgy Kirichenko
2020-01-19 17:32     ` Vladislav Shpilevoy
2020-01-20 19:21       ` Georgy Kirichenko
2020-01-18 19:27 ` [Tarantool-patches] [PATCH v2 0/3] Fiber storage leak Igor Munkin
2020-02-15  1:02 ` Vladislav Shpilevoy

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=20200120072234.GB19835@atlas \
    --to=kostja.osipov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/3] fiber: destroy fiber.storage created by iproto' \
    /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