Patch Detail
Show a patch.
GET /api/patches/13513/?format=api
{ "id": 13513, "url": "https://patchwork.libcamera.org/api/patches/13513/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13513/", "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": "<20210826132346.1238420-4-nicolas@ndufresne.ca>", "date": "2021-08-26T13:23:46", "name": "[libcamera-devel,v2,3/3] libcamerasrc: Fix deadlock on EOS", "commit_ref": "d3be776654076f7048c4365190535c0a2c39ad51", "pull_url": null, "state": "accepted", "archived": false, "hash": "1205a2fd40a2a0091f1b1bfab5e3c8123cb2170b", "submitter": { "id": 30, "url": "https://patchwork.libcamera.org/api/people/30/?format=api", "name": "Nicolas Dufresne", "email": "nicolas@ndufresne.ca" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13513/mbox/", "series": [ { "id": 2399, "url": "https://patchwork.libcamera.org/api/series/2399/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2399", "date": "2021-08-26T13:23:43", "name": "Fix Gnome Cheese and multiple camera", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2399/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13513/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13513/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 2BC7BC3242\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Aug 2021 13:24:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 42F9268921;\n\tThu, 26 Aug 2021 15:24:05 +0200 (CEST)", "from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59ACD6890C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 15:24:02 +0200 (CEST)", "from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nicolas) with ESMTPSA id 7BA1A1F44332" ], "From": "Nicolas Dufresne <nicolas@ndufresne.ca>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 26 Aug 2021 09:23:46 -0400", "Message-Id": "<20210826132346.1238420-4-nicolas@ndufresne.ca>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210826132346.1238420-1-nicolas@ndufresne.ca>", "References": "<20210826132346.1238420-1-nicolas@ndufresne.ca>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/3] libcamerasrc: Fix deadlock on EOS", "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": "Nicolas Dufresne <nicolas.dufresne@collabora.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nIt's not allowed in GStreamer to push events while holding the object\nlock. This reduce the scope into which we hold the object lock. In\nfact we don't need to protect against gst_task_resume() concurrency\nwhen we stop the task as resume only do something if the task is paused.\n\nThis fixes a deadlock when running multiple instances of libcamerasrc\nand closing one of the streaming window.\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex bdd9f88c..2be44edd 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -312,12 +312,6 @@ gst_libcamera_src_task_run(gpointer user_data)\n \t}\n \n \t{\n-\t\t/*\n-\t\t * Here we need to decide if we want to pause or stop the task. This\n-\t\t * needs to happen in lock step with the callback thread which may want\n-\t\t * to resume the task.\n-\t\t */\n-\t\tGLibLocker lock(GST_OBJECT(self));\n \t\tif (ret != GST_FLOW_OK) {\n \t\t\tif (ret == GST_FLOW_EOS) {\n \t\t\t\tg_autoptr(GstEvent) eos = gst_event_new_eos();\n@@ -332,6 +326,12 @@ gst_libcamera_src_task_run(gpointer user_data)\n \t\t\treturn;\n \t\t}\n \n+\t\t/*\n+\t\t * Here we need to decide if we want to pause. This needs to\n+\t\t * happen in lock step with the callback thread which may want\n+\t\t * to resume the task and might push pending buffers.\n+\t\t */\n+\t\tGLibLocker lock(GST_OBJECT(self));\n \t\tbool do_pause = true;\n \t\tfor (GstPad *srcpad : state->srcpads_) {\n \t\t\tif (gst_libcamera_pad_has_pending(srcpad)) {\n", "prefixes": [ "libcamera-devel", "v2", "3/3" ] }