mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-24 07:31:22 +01:00
leaking file descriptors #18
Labels
No labels
bug
enhancement
help wanted
invalid
pull-request
question
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/ffmpeg-rockchip#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcerveny on GitHub (Feb 26, 2024).
Hello.
I am using code in alloc/free loop.
When I used "scale_rkrga" filter in cycle (avfilter_graph_alloc() ... avfilter_graph_free()) usually leaks 1 FD "anon_inode:sync_file" in /proc/PID/fd (maybe some sort of sync primitive leak).
When I used "h264_rkmpp" encoder in cycle (avcodec_alloc_context3() ... avcodec_free_context()) usually leaks 1 FD "/dmabuf:276910-main" in /proc/PID/fd.
("hevc_rkmpp" decoder does not need to restart, because it supports avcodec_flush_buffers()).
I cannot determine if there is problem with rk libraries or ffmpeg integration code.
Does anyone have hint/solution to this ?
Thanks, Martin
@nyanmisaka commented on GitHub (Feb 26, 2024):
@mcerveny Can you reproduce the same issue when using FFmpeg via CLI?
https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Video-Transcode#mpp-decode--mpp-encode-fastest
@mcerveny commented on GitHub (Feb 26, 2024):
Probably it is visible after all cleanup but before exit, so it can be possible in crafted ffmpeg code with sleep(100000) before exit. Now I must finish the code/application with workaround (restart application after ~500 cycles). I will try next week to prepare some minimum code to demonstrate this behavior.
For reference (out of FD descriptor), usual error:
And output from /proc/PID/fd before fail:
@nyanmisaka commented on GitHub (Feb 26, 2024):
This error only occurs when async RGA is used but the
out_fence_fdreturned is not invalidated by the user, so the FD resource will be exhausted quicky. I encountered it in earlier debugging and development, but it shouldn't be present inscale_rkrganow.BTW what's your SoC model, Linux kernel version and MPP/RGA libs commit date?
@mcerveny commented on GitHub (Feb 26, 2024):
@nyanmisaka commented on GitHub (Feb 26, 2024):
Then it should all work fine. I may need to wait for a demo from you to see what's going on.
@mcerveny commented on GitHub (Feb 26, 2024):
https://github.com/nyanmisaka/rk-mirrors/blob/jellyfin-rga/core/NormalRga.cpp#L1485
@nyanmisaka commented on GitHub (Feb 29, 2024):
@mcerveny Hopefully the commit
377fa2cwill fix this issue. Let me know if it helps.@mcerveny commented on GitHub (Mar 5, 2024):
Yes, it partially works, "non_inode:sync_file" is gone but dmabuf:*-main remains (encoder leak).
@nyanmisaka commented on GitHub (Mar 6, 2024):
@mcerveny From my understanding, MPP async encoding requires
rkmppencto retain references to some input frames, which will be notified by MPP callbacks and thus be dynamically released. But whencodec->close()is called, these reserved frames will be released unconditionally.Can you help me trace in which
rkmppencfunction the leak occurred?d43f4f54e6/libavcodec/rkmppenc.c (L800)@mcerveny commented on GitHub (Mar 9, 2024):
It seems to be related to #35. The problem is gone with my quick patch. (tested with loop 100 frames input * 2000 (different video segments)).
@nyanmisaka commented on GitHub (Mar 10, 2024):
Closed by
7a0200b