{"id":13117,"url":"https://patchwork.libcamera.org/api/1.1/patches/13117/?format=json","web_url":"https://patchwork.libcamera.org/patch/13117/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210726103126.43238-1-umang.jain@ideasonboard.com>","date":"2021-07-26T10:31:26","name":"[libcamera-devel] utils: ipc: Assign a new gid to proxy worker","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5744446f14cb62124999ac763bf2e3061d6ceded","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13117/mbox/","series":[{"id":2277,"url":"https://patchwork.libcamera.org/api/1.1/series/2277/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2277","date":"2021-07-26T10:31:26","name":"[libcamera-devel] utils: ipc: Assign a new gid to proxy worker","version":1,"mbox":"https://patchwork.libcamera.org/series/2277/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13117/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13117/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 88189C322C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Jul 2021 10:31:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B46D68536;\n\tMon, 26 Jul 2021 12:31:35 +0200 (CEST)","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 D258068536\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jul 2021 12:31:33 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8DED8332;\n\tMon, 26 Jul 2021 12:31:32 +0200 (CEST)"],"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=\"jT03NINn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627295493;\n\tbh=KpntycZyjKPX62i1VU+SPBIKw2z6hIN52IU/+5LxhF0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=jT03NINnCVsfkRu+EmN6eFLPRC+zNIYPuTemF5CtTNM0evB0bFlxh5Jl7eIbAZGi5\n\tcsV7PkVD71WCp+/fXJ0b607tBy5xXcUwjWShI4wf/+2f/UdfISv214UeD/uV/cdS+n\n\t3DUvfbECs51IFYusJ1B6vX3kRWDxbox1DFmpoK/Q=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 26 Jul 2021 16:01:26 +0530","Message-Id":"<20210726103126.43238-1-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] utils: ipc: Assign a new gid to proxy\n\tworker","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":"Doing so, handles the situation where the proxy worker\nhas been shutdown by SIGINT/SIGTERM preemptively, before\nthe pipeline handler got a chance to cleanup nicely.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=60\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n .../module_ipa_proxy_worker.cpp.tmpl                   | 10 ++++++++++\n 1 file changed, 10 insertions(+)","diff":"diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl\nindex d993e39e..32ac3869 100644\n--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl\n@@ -207,6 +207,16 @@ int main(int argc, char **argv)\n \t\treturn EXIT_FAILURE;\n \t}\n \n+\t/*\n+\t * Shutdown of proxy worker can be preemptive by events like\n+\t * SIGINT/SIGTERM, even before the pipeline handler can request\n+\t * shutdown. Hence, assign a new gid to handle these situations.\n+\t */\n+\tif (setpgid(0, 0) < -1) {\n+\t\tLOG({{proxy_worker_name}}, Warning)\n+\t\t\t<< \"Failed to set new gid: \" << strerror(errno);\n+\t}\n+\n \t{{proxy_worker_name}} proxyWorker;\n \tint ret = proxyWorker.init(ipam, fd);\n \tif (ret < 0) {\n","prefixes":["libcamera-devel"]}