Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Georgy Kirichenko <georgy@tarantool.org>,
	tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH] Fix fiber_join() hang in case fiber_cancel() was called
Date: Tue, 5 Feb 2019 09:28:01 +0300	[thread overview]
Message-ID: <08B70EC3-6EA3-405B-964F-7C10B5BA62F3@tarantool.org> (raw)
In-Reply-To: <20190204174404.qyalziyrhz6use5g@esperanza>

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]



> 4 февр. 2019 г., в 20:44, Vladimir Davydov <vdavydov.dev@gmail.com> написал(а):
> 
>> 
>> diff --git a/src/fiber.c b/src/fiber.c
>> index 6f3d0ab78..4dc6b3c5a 100644
>> --- a/src/fiber.c
>> +++ b/src/fiber.c
>> @@ -392,9 +392,17 @@ fiber_join(struct fiber *fiber)
>> 	assert(fiber->flags & FIBER_IS_JOINABLE);
>> 
>> 	if (! fiber_is_dead(fiber)) {
>> -		rlist_add_tail_entry(&fiber->wake, fiber(), state);
>> 
>> 		do {
>> +			/*
>> +			 * In case fiber is cancelled during yield
>> +			 * it will be removed from wake queue by a
>> +			 * wakeup following the cancel.
>> +			 * Having multiple entries for the same fiber
>> +			 * doesn't hurt, since wakeup is executed only
>> +			 * once per fiber.
>> +			 */
>> +			rlist_add_tail_entry(&fiber->wake, fiber(), state);
> 
> I don't quite like the idea that cancelling a fiber that is joining
> another fiber will have no effect until the other fiber has exited.
> Can't we break the loop if fiber_is_cancelled()?

We can do that. But then we have to set FIBER_IS_JOINABLE to false
for the joined fiber so that it executes fiber_recycle(). Otherwise it will leak.
Is it ok?

[-- Attachment #2: Type: text/html, Size: 7386 bytes --]

  reply	other threads:[~2019-02-05  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 13:51 Serge Petrenko
2019-02-04 17:44 ` Vladimir Davydov
2019-02-05  6:28   ` Serge Petrenko [this message]
2019-02-05  9:00     ` [tarantool-patches] " Vladimir Davydov
2019-02-05 15:02       ` Serge Petrenko

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=08B70EC3-6EA3-405B-964F-7C10B5BA62F3@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] Re: [PATCH] Fix fiber_join() hang in case fiber_cancel() was called' \
    /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