Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7971 closed defect (invalid)

Hung process poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) / rtmp input timeout

Reported by: jidckii Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: jidckii@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:
I run ffmpeg in the docker container

jidckii/ffmpeg:4-1-0-v1-1-0

The process is frozen and does nothing.
At the time of the creation of the ticket, it has been hanging for 19 hours.
Similar problem: http://michael-peeters.blogspot.com/2019/03/hanging-m3u8-downloads-in-ffmpeg.html

At the time of the problem, the network connection was briefly lost.

% ffmpeg -i input ... output
ffmpeg -version
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --arch=amd64 --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-ldl --prefix=/usr/local
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100



jidckii@keikogi~14:09:31:~$  ps -ef | grep plot_hd
root      5877 19491  0 июн24 ?     00:00:28 /usr/local/bin/ffmpeg -xerror -abort_on empty_output -nostats -hide_banner -progress /dev/stdout -loglevel repeat+level+info -analyzeduration 10000000 -probesize 10000000 -i rtmp://mediasrv.uralttk.ru/rtplive/plot_hd.stream -vsync -1 -map 0:0 -c:v copy -an -f hls -use_localtime 1 -hls_time 3 -hls_list_size 10 -hls_flags delete_segments+second_level_segment_index -hls_segment_filename %y%m%d_%H%M%S_%%06d.ts index.m3u8


$ sudo strace -r -T -f -p 5877 
strace: Process 5877 attached
     0.000000 restart_syscall(<... resuming interrupted poll ...>) = 0 <0.031468>
     0.031566 poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) <0.100140>
     0.100305 poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) <0.100110>
     0.100408 poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) <0.100164>
     0.100489 poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) <0.100330>
     0.100932 poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) <0.101226>
     0.100666 poll([{fd=4, events=POLLIN}], 1, 100^Cstrace: Process 5877 detached
 <detached ...>



lsof -p 3917 (pid in docker container)
COMMAND  PID USER   FD   TYPE   DEVICE SIZE/OFF     NODE NAME
ffmpeg  3917 root  cwd    DIR    0,139      340        2 /tmp/live/hls
ffmpeg  3917 root  rtd    DIR    0,140     4096  1981846 /
ffmpeg  3917 root  txt    REG    0,140   214240   535741 /usr/local/bin/ffmpeg
ffmpeg  3917 root  mem    REG    253,0            535741 /usr/local/bin/ffmpeg (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406860 /lib/x86_64-linux-gnu/libresolv-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406839 /lib/x86_64-linux-gnu/libnss_dns-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406841 /lib/x86_64-linux-gnu/libnss_files-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537186 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537180 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537188 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537222 /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537211 /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.34.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406881 /lib/x86_64-linux-gnu/libuuid.so.1.3.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537136 /lib/x86_64-linux-gnu/libexpat.so.1.6.2 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537134 /lib/x86_64-linux-gnu/libbsd.so.0.8.3 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406862 /lib/x86_64-linux-gnu/librt-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406831 /lib/x86_64-linux-gnu/libmvec-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537190 /usr/lib/x86_64-linux-gnu/libcairo.so.2.11400.8 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537207 /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406819 /lib/x86_64-linux-gnu/libgcc_s.so.1 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            524985 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406811 /lib/x86_64-linux-gnu/libdl-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537213 /usr/lib/x86_64-linux-gnu/libpng16.so.16.28.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537203 /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536055 /usr/local/lib/libfontconfig.so.1.12.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537201 /usr/lib/x86_64-linux-gnu/libfribidi.so.0.3.6 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537184 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537182 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536063 /usr/local/lib/libkvazaar.so.4.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537228 /usr/lib/x86_64-linux-gnu/libxvidcore.so.4.3 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536126 /usr/local/lib/libx265.so.165 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536123 /usr/local/lib/libx264.so.155 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536111 /usr/local/lib/libvorbisenc.so.2.0.11 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536106 /usr/local/lib/libvorbis.so.0.4.8 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537218 /usr/lib/x86_64-linux-gnu/libtheoradec.so.1.1.4 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537220 /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1.1.2 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536087 /usr/local/lib/libopus.so.0.7.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536081 /usr/local/lib/libopenjp2.so.2.3.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536073 /usr/local/lib/libopencore-amrnb.so.0.0.3 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536068 /usr/local/lib/libmp3lame.so.0.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536051 /usr/local/lib/libfdk-aac.so.1.0.1 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536078 /usr/local/lib/libopencore-amrwb.so.0.0.3 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406825 /lib/x86_64-linux-gnu/liblzma.so.5.2.2 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536121 /usr/local/lib/libvpx.so.5.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537191 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537214 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406883 /lib/x86_64-linux-gnu/libz.so.1.2.8 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406800 /lib/x86_64-linux-gnu/libbz2.so.1.0.4 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536059 /usr/local/lib/libfreetype.so.6.16.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536101 /usr/local/lib/libvidstab.so.1.1 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536022 /usr/local/lib/libass.so.9.0.2 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537224 /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            537226 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406801 /lib/x86_64-linux-gnu/libc-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406858 /lib/x86_64-linux-gnu/libpthread-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406826 /lib/x86_64-linux-gnu/libm-2.24.so (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536046 /usr/local/lib/libavutil.so.56.22.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536099 /usr/local/lib/libswscale.so.5.3.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536095 /usr/local/lib/libswresample.so.3.3.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536091 /usr/local/lib/libpostproc.so.55.3.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536042 /usr/local/lib/libavresample.so.4.0.0 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536026 /usr/local/lib/libavcodec.so.58.35.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536038 /usr/local/lib/libavformat.so.58.20.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536034 /usr/local/lib/libavfilter.so.7.40.101 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            536030 /usr/local/lib/libavdevice.so.58.5.100 (path dev=0,140)
ffmpeg  3917 root  mem    REG    253,0            406783 /lib/x86_64-linux-gnu/ld-2.24.so (path dev=0,140)
ffmpeg  3917 root    0r   CHR      1,3      0t0        6 /dev/null
ffmpeg  3917 root    1w  FIFO     0,12      0t0 15462578 pipe
ffmpeg  3917 root    2w  FIFO     0,12      0t0 15462579 pipe
ffmpeg  3917 root    3w  FIFO     0,12      0t0 15462578 pipe
ffmpeg  3917 root    4u  IPv4 15462591      0t0      TCP f4915a94d2e8:42724->80.78.116.125:1935 (ESTABLISHED)
ffmpeg  3917 root    5w   REG    0,139  1048576        9 /tmp/live/hls/190624_150308_000197.ts



root@f4915a94d2e8:/opt/yucca# ls -la  /proc/3917/fd/4
lrwx------ 1 root root 64 Jun 25 09:12 /proc/3917/fd/4 -> socket:[15462591]
root@f4915a94d2e8:/opt/yucca# lsof -p 3917 | grep 15462591
ffmpeg  3917 root    4u  IPv4 15462591      0t0      TCP f4915a94d2e8:42724->80.78.116.125:1935 (ESTABLISHED)



Change History (5)

comment:1 by jidckii, 5 years ago

Priority: criticalnormal
Resolution: fixed
Status: newclosed

flag -timeout before flag -i

comment:2 by Carl Eugen Hoyos, 5 years ago

Keywords: poll timeout tcp removed
Resolution: fixedinvalid
Version: 4.1unspecified

comment:3 by jidckii, 5 years ago

Cc: jidckii@gmail.com added
Keywords: rtmp input timeout added
Priority: normalimportant
Resolution: invalid
Status: closedreopened
Summary: Hung process poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout)Hung process poll([{fd=4, events=POLLIN}], 1, 100) = 0 (Timeout) / rtmp input timeout

Timeout worked when the input is http, but for rtmp there is no timeout option for the incoming stream. There is only for -listen.
How to set timeout for rtmp for input?

comment:4 by jidckii, 5 years ago

Resolution: fixed
Status: reopenedclosed

https://ffmpeg.org/ffmpeg-all.html#Protocols

All protocols accept the following options:

rw_timeout
Maximum time to wait for (network) read/write operations to complete, in microseconds.

comment:5 by Carl Eugen Hoyos, 5 years ago

Keywords: rtmp input timeout removed
Priority: importantnormal
Resolution: fixedinvalid
Note: See TracTickets for help on using tickets.