Show a patch.

GET /api/1.1/patches/13914/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13914,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13914/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13914/",
    "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": "<20210924064409.317140-1-umang.jain@ideasonboard.com>",
    "date": "2021-09-24T06:44:09",
    "name": "[libcamera-devel] android: camera_device: Fix race on queuing capture request",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2ae3434406bbd79db46dde9fcebb08364ec4367b",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/13914/mbox/",
    "series": [
        {
            "id": 2557,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2557/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2557",
            "date": "2021-09-24T06:44:09",
            "name": "[libcamera-devel] android: camera_device: Fix race on queuing capture request",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2557/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13914/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13914/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 75A9DBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Sep 2021 06:44:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C219B6918C;\n\tFri, 24 Sep 2021 08:44:18 +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 4F52960242\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Sep 2021 08:44:17 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.86])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 34EAC45E;\n\tFri, 24 Sep 2021 08:44:16 +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=\"U2gB/TI+\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632465856;\n\tbh=biJrUr6DrGWrF3HLHuAduc6PaHH7FxsB+VlxpoRXGVA=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=U2gB/TI+PtiGnVvAKmUsc2qaX+iFBda/BF+HdrTnEC2g+aq46GEVn22plWLy8cL2P\n\tn1y9TF5qTCTllwoceeXddUkxO4ps+zS/Zbh+l4bGyK0d/MlQzcctaHEPy3YwkQPbCx\n\tQcrxZiT7fPgzcLBmi4Slr9IpvAPwsCybMdJ1rTWg=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 24 Sep 2021 12:14:09 +0530",
        "Message-Id": "<20210924064409.317140-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] android: camera_device: Fix race on\n\tqueuing capture request",
        "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 Camera3RequestDescriptor containing the capture request\nis adding to the descriptors_ map after a call to\nCameraWorker::queueRequest(). This is a race condition since\nCameraWorker::queueRequest() queues request to libcamera::Camera\nasynchronously and the addition of the descriptor to the map\noccurs with std::move(). Hence, it might happen that the async\nqueueRequest() hasn't finished but the descriptor gets std::move()ed.\n\nFix it by adding the descriptor to map first, before\nCameraWorker::queueRequest().\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_device.cpp | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 21844e51..c4c03d86 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1065,13 +1065,14 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\tstate_ = State::Running;\n \t}\n \n-\tworker_.queueRequest(descriptor.request_.get());\n-\n+\tunsigned long requestCookie = descriptor.request_->cookie();\n \t{\n \t\tMutexLocker descriptorsLock(descriptorsMutex_);\n-\t\tdescriptors_[descriptor.request_->cookie()] = std::move(descriptor);\n+\t\tdescriptors_[requestCookie] = std::move(descriptor);\n \t}\n \n+\tworker_.queueRequest(descriptors_[requestCookie].request_.get());\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}