Patch Detail
Show a patch.
GET /api/patches/24298/?format=api
{ "id": 24298, "url": "https://patchwork.libcamera.org/api/patches/24298/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24298/", "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": "<20250909131237.1344483-1-barnabas.pocze@ideasonboard.com>", "date": "2025-09-09T13:12:37", "name": "[RFC,v1] gstreamer: Be prepared when queueing request", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "3a4b1a773298e6bcd6144a5f452e92d624fac3fd", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24298/mbox/", "series": [ { "id": 5426, "url": "https://patchwork.libcamera.org/api/series/5426/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5426", "date": "2025-09-09T13:12:37", "name": "[RFC,v1] gstreamer: Be prepared when queueing request", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5426/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24298/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24298/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 E4D0DC324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 9 Sep 2025 13:12:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B8FDB6934B;\n\tTue, 9 Sep 2025 15:12:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 41CD86934B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 9 Sep 2025 15:12:41 +0200 (CEST)", "from pb-laptop.local (185.221.142.115.nat.pool.zt.hu\n\t[185.221.142.115])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B55FB605;\n\tTue, 9 Sep 2025 15:11:27 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CVJgbTKn\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1757423487;\n\tbh=Ox2z/AgDHLmy5Ij8/QGKdKF5aHDktkaOWvg/iolJo20=;\n\th=From:To:Subject:Date:From;\n\tb=CVJgbTKnIikVmMWeNaGJx4+T7rv1Q6dgyPsIgE9NkLBGc4S2kHynr1fkh5Am2ZQAT\n\tZDewQ0g1PjLSWfeHwiNt8C5TetYu94X/AG0HfMERVtTdaUaOLNhxn0At/gq1234I/f\n\ttaGmy3J+y/TEFp5z62CW4Jcr68FYEdpRvXAWTA8g=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>,\n\tUmang Jain <uajain@igalia.com>", "Subject": "[RFC PATCH v1] gstreamer: Be prepared when queueing request", "Date": "Tue, 9 Sep 2025 15:12:37 +0200", "Message-ID": "<20250909131237.1344483-1-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.51.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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": "The moment execution enters `Camera::queueRequest()`, an application must be\nprepared to received the corresponding `requestCompleted` signal. However,\nthe gstreamer element is currently not prepared: it queues the request,\ntakes a lock, then inserts into a list.\n\nIf the request completion handler acquires the lock right after the queueing,\nthen it will not find the object in the list that it expects. Even potentially\nencountering an empty list, running into undefined behaviour when trying\nto pop from it.\n\nFix that by queueing the request after the lock protected insertion.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=238\nFixes: 06bd05beced313 (\"gstreamer: Use dedicated lock for request queues\")\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n\nDoing it while holding the lock is not ideal, but the alternative is\ngetting a raw pointer to the `Request` object beforehand, but that does\nnot seem too desirable either.\n\n---\n src/gstreamer/gstlibcamerasrc.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n--\n2.51.0", "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 79a025a57..103dfbca2 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -214,10 +214,10 @@ int GstLibcameraSrcState::queueRequest()\n \t}\n\n \tGST_TRACE_OBJECT(src_, \"Requesting buffers\");\n-\tcam_->queueRequest(wrap->request_.get());\n\n \t{\n \t\tGLibLocker locker(&lock_);\n+\t\tcam_->queueRequest(wrap->request_.get());\n \t\tqueuedRequests_.push(std::move(wrap));\n \t}\n\n", "prefixes": [ "RFC", "v1" ] }