Skip to content

fix(video): Prevent hang in SkipFramesImpl by adding pop retry limit - #342

Open
xx205 wants to merge 1 commit into
dmlc:masterfrom
xx205:master
Open

fix(video): Prevent hang in SkipFramesImpl by adding pop retry limit#342
xx205 wants to merge 1 commit into
dmlc:masterfrom
xx205:master

Conversation

@xx205

@xx205 xx205 commented Apr 18, 2025

Copy link
Copy Markdown

SkipFramesImpl could hang when decoder_->Pop returned false after receiving an empty NDArray (EAGAIN signal), as the skip counter didn't decrement. If the decoder then stalled, frame_count_ remained zero, causing subsequent Pop calls to fail rapidly at the entry check, leading to hangs or malloc deadlocks. This commit adds a retry limit to the SkipFramesImpl loop to break this rapid failure cycle after consecutive Pop failures. This improves robustness when skipping frames in problematic videos after seeking.

SkipFramesImpl could hang when `decoder_->Pop` returned `false` after receiving an empty NDArray (EAGAIN signal), as the skip counter didn't decrement. If the decoder then stalled, `frame_count_` remained zero, causing subsequent `Pop` calls to fail rapidly at the entry check, leading to hangs or malloc deadlocks. This commit adds a retry limit to the `SkipFramesImpl` loop to break this rapid failure cycle after consecutive `Pop` failures. This improves robustness when skipping frames in problematic videos after seeking.
@xx205

xx205 commented Apr 18, 2025

Copy link
Copy Markdown
Author

yudian0504 added a commit to yudian0504/decord2 that referenced this pull request Nov 23, 2025
chr431 pushed a commit to chr431/decord that referenced this pull request Aug 15, 2026
从 dmlc/decord open issues/PR 筛选并本地验证后移植:
- NDArray.pts int->int64_t(dmlc#269/dmlc#341);SkipFramesImpl 用 Drained() 判真 EOF,避免容器虚标帧数时死循环并采样 EOF 幽灵帧(dmlc#373/dmlc#342)
- CheckKeyFrame EOF 出口 + GetFrameCount avg_frame_rate.den==0 防除零(dmlc#230)
- FFmpeg 7 buffersink pix_fmts 类型变化守卫(libavfilter>=10,PR dmlc#368),新增 Windows FFmpeg 7.1 CI job
- 帧索引缓存版本混入 LIBAVFORMAT_VERSION_INT,防止跨 FFmpeg 构建误用旧缓存(本地实测 7.1/8.1 时间戳不一致)
- ctypes 默认 RTLD_LOCAL + DECORD_RTLD_GLOBAL 逃生开关,PATH 缺失兜底(dmlc#361/dmlc#362/dmlc#357)
- _init_internal_api 显式 import _api_internal(PR dmlc#364);AVReader sample_rate 默认值与文档对齐为 -1(PR dmlc#237)
- VideoReader.close()/上下文管理器(dmlc#222);GPU VP8 映射(dmlc#217);worker 停止后的 Push 可读报错(dmlc#321)
- 新增回归:large_pts.mp4 大 PTS get_batch/seek、close/context manager、PATH 缺失、RTLD_GLOBAL 开关、AVReader 默认值
- 本地验证:Windows GPU FFmpeg 8.1 61 tests、CPU FFmpeg 8.1 60 tests、CPU FFmpeg 7.1 60 tests 全绿
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant