[{"id":28554,"web_url":"https://patchwork.libcamera.org/comment/28554/","msgid":"<87o7dd6swh.fsf@redhat.com>","date":"2024-01-22T19:59:42","subject":"Re: [PATCH 06/12] test: message: Remove incorrect slow receiver test","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> The slow receiver test verifies there's no race condition between\n> concurrent message delivery and object deletion. This is no a valid use\n                                                           ^^^^\nno\n\n> case in the first place, as objects are not allowed to be deleted \n\n... or messaged ...\n\n> from a different thread than the one they are bound to. Remove the incorrect\n> test.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  test/message.cpp | 34 ----------------------------------\n>  1 file changed, 34 deletions(-)\n>\n> diff --git a/test/message.cpp b/test/message.cpp\n> index 0e76f323e3b9..a34e0f0b5e10 100644\n> --- a/test/message.cpp\n> +++ b/test/message.cpp\n> @@ -93,25 +93,6 @@ private:\n>  \tbool success_;\n>  };\n>  \n> -class SlowMessageReceiver : public Object\n> -{\n> -protected:\n> -\tvoid message(Message *msg)\n> -\t{\n> -\t\tif (msg->type() != Message::None) {\n> -\t\t\tObject::message(msg);\n> -\t\t\treturn;\n> -\t\t}\n> -\n> -\t\t/*\n> -\t\t * Don't access any member of the object here (including the\n> -\t\t * vtable) as the object will be deleted by the main thread\n> -\t\t * while we're sleeping.\n> -\t\t */\n> -\t\tthis_thread::sleep_for(chrono::milliseconds(100));\n> -\t}\n> -};\n> -\n>  class MessageTest : public Test\n>  {\n>  protected:\n> @@ -148,21 +129,6 @@ protected:\n>  \t\t\tbreak;\n>  \t\t}\n>  \n> -\t\t/*\n> -\t\t * Test for races between message delivery and object deletion.\n> -\t\t * Failures result in assertion errors, there is no need for\n> -\t\t * explicit checks.\n> -\t\t */\n> -\t\tSlowMessageReceiver *slowReceiver = new SlowMessageReceiver();\n> -\t\tslowReceiver->moveToThread(&thread_);\n> -\t\tslowReceiver->postMessage(std::make_unique<Message>(Message::None));\n> -\n> -\t\tthis_thread::sleep_for(chrono::milliseconds(10));\n> -\n> -\t\tdelete slowReceiver;\n> -\n> -\t\tthis_thread::sleep_for(chrono::milliseconds(100));\n> -\n>  \t\t/*\n>  \t\t * Test recursive calls to Thread::dispatchMessages(). Messages\n>  \t\t * should be delivered correctly, without crashes or memory","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B2527C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Jan 2024 19:59:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BA3AF62936;\n\tMon, 22 Jan 2024 20:59:50 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E3EF628B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jan 2024 20:59:48 +0100 (CET)","from mail-wr1-f71.google.com (mail-wr1-f71.google.com\n\t[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-463-EwVoCbbnNMCC77TwlCJD_w-1; Mon, 22 Jan 2024 14:59:46 -0500","by mail-wr1-f71.google.com with SMTP id\n\tffacd0b85a97d-33921ffe6b4so1321423f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jan 2024 11:59:46 -0800 (PST)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tn19-20020a05600c501300b0040e813f1f31sm24543616wmr.25.2024.01.22.11.59.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 22 Jan 2024 11:59:43 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"N9CRy4bN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1705953588;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=NZfZQpgLk9CXnj7PrsAwBdE31v3sp0yKLUC6DRqi8uo=;\n\tb=N9CRy4bN/Ba8hkk5tvKiI0nuzyzudl15W5+egBCV++U+v3VPfPAJS9LbBP7dDgtZPyW86M\n\tNI0RQFhLDL7mVN7l6yYteQoINtks3lc3s0Rmge6PD4ClZL8sThZBMnIfmJL/ZnqYZJcTVC\n\tMIfD/a3C9bIWQoPp2f9peBTaujgaCoE=","X-MC-Unique":"EwVoCbbnNMCC77TwlCJD_w-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1705953584; x=1706558384;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=NZfZQpgLk9CXnj7PrsAwBdE31v3sp0yKLUC6DRqi8uo=;\n\tb=Bjo3lL7o6EAaz2N0Bfs5L/IbRDAr8pGP3yxJuTGnrzaQQLEnGMH2QXKXBiKn9aBzxm\n\tyEQcd0PS1ehE8qicUXXb/0uZc6P0uCdRzaTdjbp2Q0bZAj2q79CqS/paWMVGrlrUZTeo\n\th0gtSR1VokBQvf4abRLybzPjZ0mKX4KY+dl7VfKakjiyd9otZrv/FbhcxoorBIM8JHZB\n\t7ZORMdd3QmcpYz4f26p+n4dznfLoVAyUOt1BXZLxYF+ep1p2oNs0MSVLKnUsQpUaTVya\n\tQZFT1d6SZaeoPYoOp2woZzquJpYYI/SFc8iB/7//DNPdWr8MmPoXWhXtvzzoVByjP3fB\n\tzBZg==","X-Gm-Message-State":"AOJu0YxXfDUuFEJKar0nSyIUe9Bdu01MhhGABhc/herVt7YmULtrBkxW\n\tlrck+Iey4ocYnX79ena1qw3XH+XpKKMUKyMsxPAFc0ViByWZfUFBDeAyqeTgTGyUjgkpmaZGqAU\n\t45tO7Q8ou2kwv+cP0I5XGGRhKxMmxiMJGCNhXp2aV3613/daQFuIAmMMcgU6G0adQBYPAr0obXW\n\tBKiZdCx1GGAxu/8PeXL7m59/KKMQfwjON9LPkbeRO9C9HuXd+HdOXQw0g=","X-Received":["by 2002:a05:600c:2283:b0:40e:44ab:5953 with SMTP id\n\t3-20020a05600c228300b0040e44ab5953mr2550418wmf.156.1705953584326; \n\tMon, 22 Jan 2024 11:59:44 -0800 (PST)","by 2002:a05:600c:2283:b0:40e:44ab:5953 with SMTP id\n\t3-20020a05600c228300b0040e44ab5953mr2550410wmf.156.1705953583918; \n\tMon, 22 Jan 2024 11:59:43 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IGguP8Gf9J753GzipOHAjUo/YaEIWUS7/ZwHyYjAFDkLpa22gKsTBVcCxu663Wl3RDZ4j/0RA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH 06/12] test: message: Remove incorrect slow receiver test","In-Reply-To":"<20240121035948.4226-7-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Sun, 21 Jan 2024 05:59:42 +0200\")","References":"<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>\n\t<20240121035948.4226-7-laurent.pinchart@ideasonboard.com>","Date":"Mon, 22 Jan 2024 20:59:42 +0100","Message-ID":"<87o7dd6swh.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28572,"web_url":"https://patchwork.libcamera.org/comment/28572/","msgid":"<20240123003354.GE10843@pendragon.ideasonboard.com>","date":"2024-01-23T00:33:54","subject":"Re: [PATCH 06/12] test: message: Remove incorrect slow receiver test","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jan 22, 2024 at 08:59:42PM +0100, Milan Zamazal wrote:\n> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n> \n> > The slow receiver test verifies there's no race condition between\n> > concurrent message delivery and object deletion. This is no a valid use\n>                                                            ^^^^\n> no\n\nWill fix.\n\n> > case in the first place, as objects are not allowed to be deleted \n> \n> ... or messaged ...\n\nPosting a message is fine, that function is thread-safe.\n\n> > from a different thread than the one they are bound to. Remove the incorrect\n> > test.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> \n> > ---\n> >  test/message.cpp | 34 ----------------------------------\n> >  1 file changed, 34 deletions(-)\n> >\n> > diff --git a/test/message.cpp b/test/message.cpp\n> > index 0e76f323e3b9..a34e0f0b5e10 100644\n> > --- a/test/message.cpp\n> > +++ b/test/message.cpp\n> > @@ -93,25 +93,6 @@ private:\n> >  \tbool success_;\n> >  };\n> >  \n> > -class SlowMessageReceiver : public Object\n> > -{\n> > -protected:\n> > -\tvoid message(Message *msg)\n> > -\t{\n> > -\t\tif (msg->type() != Message::None) {\n> > -\t\t\tObject::message(msg);\n> > -\t\t\treturn;\n> > -\t\t}\n> > -\n> > -\t\t/*\n> > -\t\t * Don't access any member of the object here (including the\n> > -\t\t * vtable) as the object will be deleted by the main thread\n> > -\t\t * while we're sleeping.\n> > -\t\t */\n> > -\t\tthis_thread::sleep_for(chrono::milliseconds(100));\n> > -\t}\n> > -};\n> > -\n> >  class MessageTest : public Test\n> >  {\n> >  protected:\n> > @@ -148,21 +129,6 @@ protected:\n> >  \t\t\tbreak;\n> >  \t\t}\n> >  \n> > -\t\t/*\n> > -\t\t * Test for races between message delivery and object deletion.\n> > -\t\t * Failures result in assertion errors, there is no need for\n> > -\t\t * explicit checks.\n> > -\t\t */\n> > -\t\tSlowMessageReceiver *slowReceiver = new SlowMessageReceiver();\n> > -\t\tslowReceiver->moveToThread(&thread_);\n> > -\t\tslowReceiver->postMessage(std::make_unique<Message>(Message::None));\n> > -\n> > -\t\tthis_thread::sleep_for(chrono::milliseconds(10));\n> > -\n> > -\t\tdelete slowReceiver;\n> > -\n> > -\t\tthis_thread::sleep_for(chrono::milliseconds(100));\n> > -\n> >  \t\t/*\n> >  \t\t * Test recursive calls to Thread::dispatchMessages(). Messages\n> >  \t\t * should be delivered correctly, without crashes or memory","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5B908C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Jan 2024 00:33:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C157562936;\n\tTue, 23 Jan 2024 01:33:52 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F300F628B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jan 2024 01:33:50 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 840D31583;\n\tTue, 23 Jan 2024 01:32:37 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SkokgJm+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705969957;\n\tbh=NNjxb9OIKst9nsyMHoAc3Mjko0SSrApou2FfK5i0koo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SkokgJm+yF37b6b46j1z/vEhW4kt2gAZu1ySR5wjgp/foVX6nJeUf/lvv9VptyiMn\n\tcqlka7u/rFequfhEuCTfNlopdeGfqiYZiolFPACSznOXIDl8snDgAvCYSnPs/JSG5I\n\t5mLuDdHAeYu2jyFCvajtfOa17y22JySj1g304KG8=","Date":"Tue, 23 Jan 2024 02:33:54 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Subject":"Re: [PATCH 06/12] test: message: Remove incorrect slow receiver test","Message-ID":"<20240123003354.GE10843@pendragon.ideasonboard.com>","References":"<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>\n\t<20240121035948.4226-7-laurent.pinchart@ideasonboard.com>\n\t<87o7dd6swh.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<87o7dd6swh.fsf@redhat.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]