Patch Detail
Show a patch.
GET /api/patches/2380/?format=api
{ "id": 2380, "url": "https://patchwork.libcamera.org/api/patches/2380/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2380/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20191127084909.10612-2-laurent.pinchart@ideasonboard.com>", "date": "2019-11-27T08:49:06", "name": "[libcamera-devel,2/5] test: message: Add slow receiver test", "commit_ref": "d9dac46e6f7c1bfbb76daa016fd7aaa580026d70", "pull_url": null, "state": "accepted", "archived": false, "hash": "2358b4c7593aa72400137bec408f3de64a6ed367", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2380/mbox/", "series": [ { "id": 580, "url": "https://patchwork.libcamera.org/api/series/580/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=580", "date": "2019-11-27T08:49:05", "name": "[libcamera-devel,1/5] test: message: Fix message handling in MessageReceiver", "version": 1, "mbox": "https://patchwork.libcamera.org/series/580/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2380/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2380/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98A196136B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 09:49:24 +0100 (CET)", "from pendragon.tok.corp.google.com (unknown [104.132.253.101])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5392E9F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 09:49:23 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1574844564;\n\tbh=+tpnpNuEmXB3XPxl4jcSTh2xdJ+b2KJSVHjtw6pzFPQ=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=kwqSz6BCKtjtoObXiMJLJM9iDgB7Tfn11m6f9jVKtB5QJyFlwuNfSrZZ9iIYufzdo\n\tL8L6xtU3K/y0/l9Xxczop5d3/0D2AGGAP+ZC60DuEhL559t2T2CeWLHGu9gT0+hcdR\n\tnN2nwUtHEDe58s0HvBW4XCJr1L+c09bknaa/zZ3M=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Nov 2019 10:49:06 +0200", "Message-Id": "<20191127084909.10612-2-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20191127084909.10612-1-laurent.pinchart@ideasonboard.com>", "References": "<20191127084909.10612-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/5] test: message: Add slow receiver test", "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>", "X-List-Received-Date": "Wed, 27 Nov 2019 08:49:25 -0000" }, "content": "There's a race in the message delivery against object deletion. Add a\ntest that triggers it reliably. This test is expected to fail with an\nassertion error.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/message.cpp | 32 ++++++++++++++++++++++++++++++++\n 1 file changed, 32 insertions(+)", "diff": "diff --git a/test/message.cpp b/test/message.cpp\nindex cf21d5ca50d1..7ebedb557502 100644\n--- a/test/message.cpp\n+++ b/test/message.cpp\n@@ -52,6 +52,25 @@ private:\n \tStatus status_;\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@@ -88,6 +107,19 @@ 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(utils::make_unique<Message>(Message::None));\n+\n+\t\tthis_thread::sleep_for(chrono::milliseconds(10));\n+\n+\t\tdelete slowReceiver;\n+\n \t\treturn TestPass;\n \t}\n \n", "prefixes": [ "libcamera-devel", "2/5" ] }