Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH 2/2] fiber: fiber_join -- don't crash on misuse
Date: Tue, 27 Apr 2021 00:36:07 +0300	[thread overview]
Message-ID: <YIcyR5T7lg7nb8V9@grain> (raw)
In-Reply-To: <172de876-2f6c-b43f-2c0a-59697c6c82aa@tarantool.org>

On Mon, Apr 26, 2021 at 10:58:16PM +0200, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
> 
> > diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
> > index baf78a130..dd7498dd7 100644
> > --- a/src/lib/core/fiber.c
> > +++ b/src/lib/core/fiber.c
> > @@ -615,7 +615,10 @@ fiber_join(struct fiber *fiber)
> >  int
> >  fiber_join_timeout(struct fiber *fiber, double timeout)
> >  {
> > -	assert(fiber->flags & FIBER_IS_JOINABLE);
> > +	if (!(fiber->flags & FIBER_IS_JOINABLE)) {
> 
> 1. https://github.com/tarantool/tarantool/wiki/Code-review-procedure#code-style
> 
> 	In C we don't apply ! operator to non-boolean values. It means, to
> 	check if an integer is not 0, you use != 0. To check if a pointer is
> 	not NULL, you use != NULL. The same for ==;

I know. I left it this way on a purpose -- the whole file follows more
sane use of negation operator. I thought better to keep the old form,
otherwise we will have a mixture of old a new style in one file.

> >  	struct fiber *fiber = fiber_new_xc("join", noop_f);
> > +	/* gh-6046: crash on attempt to join non joinable */
> > +	fiber_set_joinable(fiber, false);
> > +	fiber_join(fiber);
> 
> 2. Would be good to test that it returns -1, and that the diag is not
> empty.

Will update, thanks!

  reply	other threads:[~2021-04-26 21:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 10:09 [Tarantool-patches] [PATCH 0/2] fiber: prevent fiber_join from misuse Cyrill Gorcunov via Tarantool-patches
2021-04-26 10:09 ` [Tarantool-patches] [PATCH 1/2] fiber: fiber_join -- drop redundat variable Cyrill Gorcunov via Tarantool-patches
2021-04-26 10:10 ` [Tarantool-patches] [PATCH 2/2] fiber: fiber_join -- don't crash on misuse Cyrill Gorcunov via Tarantool-patches
2021-04-26 20:58   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-26 21:36     ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-04-26 20:59   ` Vladislav Shpilevoy via Tarantool-patches

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=YIcyR5T7lg7nb8V9@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] fiber: fiber_join -- don'\''t crash on misuse' \
    /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