[PR] avfilter/dnn: fix teardown hang in ONNX backend (PR #24259)
Steven Xiao via ffmpeg-devel <[email protected]>
| Newsgroups | gmane.comp.video.ffmpeg.devel |
|---|---|
| Message-ID | <[email protected]> |
PR #24259 opened by Steven Xiao (younengxiao) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24259 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24259.patch This is used to fix the bug introduced by https://github.com/FFmpeg/FFmpeg/commit/b52c71e43813952650a74c57b2f31bd0166600ba . dnn_free_model_onnx() waits for the request queue to reach ctx->nireq items, but dnn_load_model_onnx() only ever allocates one. With nireq >= 2 that wait can never succeed and teardown hangs forever. ONNX inference is synchronous, so every request has already finished by the time teardown runs. Drop the wait. >From 1e38c83eaf937e17eb6f10063cbaccb111033c70 Mon Sep 17 00:00:00 2001 From: younengxiao <[email protected]> Date: Mon, 24 Aug 2026 20:44:32 -0400 Subject: [PATCH] avfilter/dnn: fix teardown hang in ONNX backend dnn_free_model_onnx() waits for the request queue to reach ctx->nireq items, but dnn_load_model_onnx() only ever allocates one. With nireq >= 2 that wait can never succeed and teardown hangs forever. ONNX inference is synchronous, so every request has already finished by the time teardown runs. Drop the wait. Signed-off-by: younengxiao <[email protected]> --- libavfilter/dnn/dnn_backend_onnx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_onnx.c b/libavfilter/dnn/dnn_backend_onnx.c index 6c75d6eb24..4c36cb7cbc 100644 --- a/libavfilter/dnn/dnn_backend_onnx.c +++ b/libavfilter/dnn/dnn_backend_onnx.c @@ -152,7 +152,11 @@ static void dnn_free_model_onnx(DNNModel **model) onnx_model = (ONNXModel *)(*model); - ff_dnn_wait_requests(onnx_model->request_queue, onnx_model->ctx->nireq); + /* + * Inference runs synchronously here: execute_model_onnx() completes the + * inference and its callback before returning, and async execution is + * rejected with ENOSYS. + */ while (ff_safe_queue_size(onnx_model->request_queue) != 0) { ONNXRequestItem *item = (ONNXRequestItem *)ff_safe_queue_pop_front(onnx_model->request_queue); destroy_request_item(&item); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]