Patch Detail
Show a patch.
GET /api/1.1/patches/15260/?format=api
{ "id": 15260, "url": "https://patchwork.libcamera.org/api/1.1/patches/15260/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15260/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220107125506.1477795-3-kieran.bingham@ideasonboard.com>", "date": "2022-01-07T12:55:06", "name": "[libcamera-devel,2/2] libcamera: base: signal: Prevent excessive slot usage", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "a70b89e65ceed980027e49398eaf9f9001f4873f", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": { "id": 11, "url": "https://patchwork.libcamera.org/api/1.1/users/11/?format=api", "username": "kbingham", "first_name": "Kieran", "last_name": "Bingham", "email": "kieran.bingham@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/15260/mbox/", "series": [ { "id": 2882, "url": "https://patchwork.libcamera.org/api/1.1/series/2882/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2882", "date": "2022-01-07T12:55:04", "name": "libcamera: pipeline_handler: Prepare requests", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2882/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15260/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15260/checks/", "tags": {}, "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 BFF20C325A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 7 Jan 2022 12:55:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 483BC608E6;\n\tFri, 7 Jan 2022 13:55:13 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16F926091E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 7 Jan 2022 13:55:11 +0100 (CET)", "from Monstersaurus.ksquared.org.uk.beta.tailscale.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B56FD11BB;\n\tFri, 7 Jan 2022 13:55:10 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"J/p3E8y6\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641560110;\n\tbh=i20JeXHm30wC0P+xND/ZuoxhTyzcltGmvvWoMiRwLxM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=J/p3E8y6Pk7yfOlYdvKjyzNI33SimLOOO8MqSRmallVNcVHdDs7wauRO73aOk8c9m\n\tm1LPggT/9pOZ4VnrRCCLOut5+bfFhmCGNW9rM84XTtGlgG5r+JQU/5oTA2brc3E8NO\n\tjGjGUOrnW3eDg8sD1QgghDcdf30Wne+QgZiVTy6g=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Fri, 7 Jan 2022 12:55:06 +0000", "Message-Id": "<20220107125506.1477795-3-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20220107125506.1477795-1-kieran.bingham@ideasonboard.com>", "References": "<20220107125506.1477795-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: base: signal: Prevent\n\texcessive slot usage", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Slots are not expected to be connected to lots of signals. Our normal\nuse case is a one to one mapping with a signal expected to call one\nslot.\n\nWhile we support multiple slots, excessive use is likely the result of a\nbug indicating a failure to disconnect slots or repeated connection of a\nslot which can lead to memory leaks and poor performance when deleting\nthe Object.\n\nAssert that a maximum of 8 slots are connected which will catch any bug\nand still allow some multiple slot usage. If this limit is ever met it\ncan be extended and considered at that time.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nNote that this patch causes the CTS tests to fail as they hit this\nassertion.\n\nIt is not yet investigated if we really need more slots or if the\nassertion has already caught a slot-leak, but posting for early review\nanyway.\n\n src/libcamera/base/signal.cpp | 8 ++++++++\n 1 file changed, 8 insertions(+)", "diff": "diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp\nindex 9df45d079a42..7e6a23cc909d 100644\n--- a/src/libcamera/base/signal.cpp\n+++ b/src/libcamera/base/signal.cpp\n@@ -7,6 +7,7 @@\n \n #include <libcamera/base/signal.h>\n \n+#include <libcamera/base/log.h>\n #include <libcamera/base/mutex.h>\n \n /**\n@@ -35,6 +36,13 @@ void SignalBase::connect(BoundMethodBase *slot)\n \tif (object)\n \t\tobject->connect(this);\n \tslots_.push_back(slot);\n+\n+\t/*\n+\t * Slots are not expected to be used to connect many items. If we exceed\n+\t * a reasonable amount, presume that there is a bug and fail fast on\n+\t * debug builds.\n+\t */\n+\tASSERT(slots_.size() < 8);\n }\n \n void SignalBase::disconnect(Object *object)\n", "prefixes": [ "libcamera-devel", "2/2" ] }