From patchwork Mon Oct 18 23:24:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 31158 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp3835564ioa; Mon, 18 Oct 2021 16:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoOBqLnKXZLSOxgVAKBH8VzQNov29MRXpWqfsSsHD/q2XlMWDoyJxAAjPqFI8dnNfShIdL X-Received: by 2002:a05:6402:22d6:: with SMTP id dm22mr48327269edb.67.1634599519510; Mon, 18 Oct 2021 16:25:19 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qb29si33572040ejc.678.2021.10.18.16.25.14; Mon, 18 Oct 2021 16:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@hotmail.com header.s=selector1 header.b=dbPq+3W+; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A41068A89C; Tue, 19 Oct 2021 02:25:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2078.outbound.protection.outlook.com [40.92.21.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B643768A336 for ; Tue, 19 Oct 2021 02:24:58 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wz+ID2W9flhRhMmkPkcibPfuc6IjWKNMwzE8fRrxZ+lkYeRiNnWK/SI71lIiJLjNn1LEWh5LVerTumWslMT5rHav3d3sCBCsm1qDzPhVTNWvjKSzKCdc28Zh3cT1M2cVs215Riy/Cl2xjw1C3bRtb3lIjc67pi6H9KAYzdTxOdXq6OmJb0w2GYyFFNkbx1GNfwUlZ9uueXIw9CPT73ffZaVQUara7srBIn01nqhqgSEC8s7jOSWbeGHwUcq2A0uOsM9b7PFKbF0NsHBpUbZSt3595EkV/19KDOY6FHEnXimvbs7gYuRxD8zI9p2BcYxQDkHKuyY6JmWZecTis5r88g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kGZ6OItobpQ9x5Kml31MdwDTisflprSmI/BaXE/9Ax8=; b=lAoM8tseTVftHIa8TDjGpoHv+ig3OGgZNbj70ZAmLukyKWjDASc3sBCGP7vT+f98tnkuVx9XRXF02Ycuov2+EFSLsAUZwGY6Ff/kcJZHoZfm7trZOJCVVz6ZKcYXn6Bbvbk4pjdQv6wWeYpGNdCRG8x8+FSoxhXtTUilkqv8ntPe1HBs81mw1fwB2sp7x0s1mnKyiKvt2srZeIg5oxAb6qUtAOJ+TaE7NtMZR5Wspbx/fXYjzQqwCkya9GMni4X3hRWBvPsq6eLdJQuIDTYc3pGQVCf5QyMIh+zl8THjNutWzYVDB/WSF+b/kkZmvIhWMwW7F24ZjlmKCuX+QLC4Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kGZ6OItobpQ9x5Kml31MdwDTisflprSmI/BaXE/9Ax8=; b=dbPq+3W+nrZnuEP1sYwqyezfMwoP69Nwinv92NZMYcDJCcBAz7dhMDoBBtzfQkzrshjYue1ilkL+cCzTZgrlepS1iz8E9pq2ZPgWzfU4eHzM0eeYfaddNSqya2qPbShA0eQKXxvLzwhytixeJhr6tFUoLO8dweTLknY4HtTpI/ATGWwujAW8JkjbLcT2Z+JpRGhILrWScf7h9oQLn2n/IFo9OZMlSmQ4nh54Y39E6bxA3bO/WMzDmUDquFEOclyWZjdMsov8aQdrGcua3Cb1VcD347gmmP5iguCAkFMQjlAUVeUmXy8CAtiPh5rBCwBf1qxRlL0vysal2CrHm8VowA== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB5598.namprd04.prod.outlook.com (2603:10b6:208:39::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Mon, 18 Oct 2021 23:24:46 +0000 Received: from MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb]) by MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb%5]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 23:24:46 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH 2/2] avutil/cuda_check: request application exit when CUDA_ERROR_UNKNOWN is received Thread-Index: AQLJGCAGgviPqDv438Xc0S3FioIsoQJkvAXrAXgV1HI= Date: Mon, 18 Oct 2021 23:24:46 +0000 Message-ID: References: <84d07dab55abfd9c83773f7061e9072ecdd73337.1634598926.git.softworkz@hotmail.com> In-Reply-To: <84d07dab55abfd9c83773f7061e9072ecdd73337.1634598926.git.softworkz@hotmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [lE/LIu7V5j0tMNOrxAm+NhcSv0KZlj6r] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e735ecd0-39f6-4e1f-e380-08d9928e794b x-ms-traffictypediagnostic: MN2PR04MB5598: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XzV4q9cQHbg+bJXy1sJp1m5nr+7UJKwnj7MfeHzrEgrLXYVcOux/vrc1WwwGSqkRpW/PHSZYeUvmAK6ZT1OhdKLUE8S66DIeH3BYwcbGRounwKlGTi8FngOZRf1t8Y49lhms7VrtNXoOg1JnLQP9MWieO4XO1x8VG+REtAL7IR6HCJrmbnMolTjtJxrTa/M1rmpDZmUVvL2cZ+m4H/00w09uAJ+Md9Bp1lK7KJRuExxQuS++51nFlo3keVSRceC5jWtN4+NgzVa4VAz0TItQNSqMlMUnwRWAgbWDpe+ph3dcLmYiyVL8BXO/6Yr5cItR/dO8f+ephVFlDao3pWx9CCb3PwGIT15+cYMPxFdRiwa4UHfyV0vyA7hhKUHG10gpE6LqXrhaKqZJ2TEB7gf0JN/b+Kj68NRYvSrGXyj9mZoZLEpqoKGA6HzWqTVROoDdGwUILJ/I84NEn5RUfwgBh4pbfeAO8Ux1JnrlbzJccdbDcClKs/I7c3mnEMYuBnUEEOH2UENugSfwBj/ynxMCzJD4u9ndxO4o3pSqx9eRHbw= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: MkN1zv51efbwhbvPYVHLmkwpSy+8KdLQe9NLw49bmEa7rLcJ+pg761T+2LcRXe1d9lbqPOJ2kA9L3GvRO9U/BV6Js4jeHV6YgFbVSMRpOGNRqa1QPO95xbu+t4k5Fx2yx+vE2sq3b1+VP9EAoydvwA== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-529c7.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB5981.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: e735ecd0-39f6-4e1f-e380-08d9928e794b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2021 23:24:46.6944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5598 Subject: [FFmpeg-devel] [PATCH 2/2] avutil/cuda_check: request application exit when CUDA_ERROR_UNKNOWN is received X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 2zPLjiRjnNTg We've seen a case where an error from cuvid api is ending up in an endless loop, creating a log file of > 10 GB like this: [h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error Error while decoding stream #0:0: Generic error in an external library [h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error Error while decoding stream #0:0: Generic error in an external library [h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error Error while decoding stream #0:0: Generic error in an external library [h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error This patch maps CUDA_ERROR_UNKNOWN to AVERROR_EXIT to make sure that the application will stop. Signed-off-by: softworkz --- libavutil/cuda_check.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavutil/cuda_check.h b/libavutil/cuda_check.h index 3aea085c07..8c54afff14 100644 --- a/libavutil/cuda_check.h +++ b/libavutil/cuda_check.h @@ -25,6 +25,8 @@ typedef CUresult CUDAAPI cuda_check_GetErrorName(CUresult error, const char** pstr); typedef CUresult CUDAAPI cuda_check_GetErrorString(CUresult error, const char** pstr); +#define CUDA_ERROR_UNKNOWN 999 + /** * Wrap a CUDA function call and print error information if it fails. */ @@ -48,6 +50,10 @@ static inline int ff_cuda_check(void *avctx, av_log(avctx, AV_LOG_ERROR, " -> %s: %s", err_name, err_string); av_log(avctx, AV_LOG_ERROR, "\n"); + // Not recoverable, request application exit + if (err == CUDA_ERROR_UNKNOWN) + return AVERROR_EXIT; + return AVERROR_EXTERNAL; }