[FFmpeg-trac] #609(avformat:new): Hang on reading UDP

FFmpeg trac at avcodec.org
Thu Nov 3 18:09:55 CET 2011


#609: Hang on reading UDP
----------------------------------+--------------------------------------
             Reporter:  Krieger   |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 Sorry for inappropriately forming the report. Time constraints.

 The symptoms:
 When opening udp:// url with libavformat, and not having explicitly set
 fifo_size=0, there's a situation when av_read_frame never exits. When
 attaching with gdb, it shows the following bt (sorry for incompleteness).
 I suspect that problem resides in libavformat/udp.c:565 of git HEAD
 988f585fcb1cfb40fe4b706c32b31594b536bba0

 We can't rely on select() to monitor new data arrival to socket that is
 recv()'ed by another thread (circular_buffer_task). Even if those socket
 calls are thread-safe, there's logical flaw.
 We are probable to miss the moment of time when new data arrive, and
 kernel can notify our select() call. We repeatedly select() for 1 second
 intervals, but between them there's time for event to happen.
 Although, this thinking does not answer on question 'why it hangs
 forever?'

 {{{
 (gdb) bt
 #0  0x00007fe62b5def13 in select () from /lib64/libc.so.6
 #1  0x00007fe62bbb7553 in udp_read (h=0x145a780, buf=<value optimized
 out>, size=<value optimized out>)
     at libavformat/udp.c:569
 #2  0x00007fe62bb3598c in retry_transfer_wrapper (h=0x145a780,
 buf=0x146aaa0 "G\037\377\020", size=1472)
     at libavformat/avio.c:269
 #3  ffurl_read (h=0x145a780, buf=0x146aaa0 "G\037\377\020", size=1472) at
 libavformat/avio.c:295
 #4  0x00007fe62bb389c6 in fill_buffer (s=0x146b0c0, buf=0x7fffce573430
 "G\037\377\020", size=188)
     at libavformat/aviobuf.c:568
 #5  avio_read (s=0x146b0c0, buf=0x7fffce573430 "G\037\377\020", size=188)
 at libavformat/aviobuf.c:657
 #6  0x00007fe62bb76d0b in read_packet (s=0x145a200, buf=0x7fffce573430
 "G\037\377\020",
     raw_packet_size=188) at libavformat/mpegts.c:1429
 #7  0x00007fe62bb77866 in handle_packets (ts=0x146b180, nb_packets=0) at
 libavformat/mpegts.c:1485
 #8  0x00007fe62bb7a01a in mpegts_read_packet (s=<value optimized out>,
 pkt=0x7fffce573610)
     at libavformat/mpegts.c:1706
 #9  0x00007fe62bbbe66c in av_read_packet (s=0x145a200, pkt=0x7fffce573610)
 at libavformat/utils.c:744
 #10 0x00007fe62bbc00da in read_frame_internal (s=0x145a200,
 pkt=0x7fffce573750)
     at libavformat/utils.c:1220
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/609>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list