From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id C8EB56C7D7; Tue, 27 Apr 2021 00:36:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C8EB56C7D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1619472970; bh=Rwy/S4Ji1tl0qTzUO5pvLw1wwRkryQJkQljROapeL9s=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=b+L/pqRuJVXPtVCYRLxuVg1D4XY185ukFUeVE60MKxG+dJoxd9a57mHLjLXlV/dO3 XXcu9ELW5Ie+m/tTTlsxrBO8JIWccGgTSy85Zh7xNgsvznAeEoVQpBqo+gg/z5v2Pq POWRS28k9iq57O0Y2DjmhwW/xwxs59HVDnCi4RGw= Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 783996FC8F for ; Tue, 27 Apr 2021 00:36:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 783996FC8F Received: by mail-lf1-f48.google.com with SMTP id n138so90632284lfa.3 for ; Mon, 26 Apr 2021 14:36:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CfRzmbeIW+BWuyIY4uyg3JkEeesIemT+S/5t8BcbW3U=; b=dA6FvJjoec1L91OMY/H+PV4+cKho9w1q1+UtUN2WOuF34fT8OIuL8SDEuKY5qOjTC+ xD9fMc4ESFeAKqGZfETeUg+dnqYn2tyxlPDnfMbIjbKyY76ontkrVfhrICCPjmTAQHm4 KkiOfYBpDYyGznxB5Xlm8ArvtVUfw7I3akurll1+tr+no+kXVfI2ceNW2VJiVfnRIqPc ljDDriBGCkuvZNlSXID56Ky64Sd8xzy6NaxUxLmOJSv7tLbQ2y+Hcpr+DriuGTn4zLkW b04pAir4rvAh30DkYMILWu2w/waF0peBTTgn9N8nYbc8Ibv/U4kB2HSgn1oKFFgIJ2vK xGpA== X-Gm-Message-State: AOAM532YV2f2OTY8C0s7PHR4WQpPFkSTKy1YorPeFzTvwXUqiC3HiVSW sC8ZbNLu+KqziBamp/7B3XtLx39QyNw= X-Google-Smtp-Source: ABdhPJwlUePG6mpGfBU+jsmZbi+PQiUnhghSl6xG2w8BCJ0A4XkyAvHIFQmCpyZPYf+JQThw4gEHjg== X-Received: by 2002:a19:c7c5:: with SMTP id x188mr1850441lff.313.1619472969444; Mon, 26 Apr 2021 14:36:09 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id j15sm1516687lfu.269.2021.04.26.14.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 14:36:08 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 9F7F356016D; Tue, 27 Apr 2021 00:36:07 +0300 (MSK) Date: Tue, 27 Apr 2021 00:36:07 +0300 To: Vladislav Shpilevoy Message-ID: References: <20210426101000.278874-1-gorcunov@gmail.com> <20210426101000.278874-3-gorcunov@gmail.com> <172de876-2f6c-b43f-2c0a-59697c6c82aa@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <172de876-2f6c-b43f-2c0a-59697c6c82aa@tarantool.org> User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH 2/2] fiber: fiber_join -- don't crash on misuse X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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!