[rtmpdump] SIGPIPE upon Server Shutdown

Evgeny Yakimov john.yakimov at gmail.com
Mon Oct 24 12:50:34 CEST 2011


I am developing an application that publishes a h264/aac FLV stream via
RTMP, I'm using libav to do all the correct flv packaging and to interface
with librtmp.

It seems that whenever the server terminates (I'm using Wowza Media Server),
librtmp causes a SIGPIPE ( I guess from trying to write to the closed
socket), Libav/avconv normally exists here due to the SIGPIPE, If I ignore
the sigpipe then what seems to happen is that rtmp still attempts to write
to the broken pipe another 40 or so times till it finally seg faults.

I've attached a trace below taken from the first SIGPIPE


WriteN, RTMP send error 104 (136 bytes)

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 0xa7b90b70 (LWP 27290)]
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7fbb9d8 in send () from /lib/i386-linux-gnu/libpthread.so.0
#2  0xb6e64392 in RTMPSockBuf_Send () from /usr/lib/librtmp.so.0
#3  0xb6e648d3 in WriteN () from /usr/lib/librtmp.so.0
#4  0xb6e64e41 in RTMP_SendPacket () from /usr/lib/librtmp.so.0
#5  0xb6e6510b in SendFCUnpublish () from /usr/lib/librtmp.so.0
#6  0xb6e647de in RTMP_Close () from /usr/lib/librtmp.so.0
#7  0xb6e64938 in WriteN () from /usr/lib/librtmp.so.0
#8  0xb6e64e41 in RTMP_SendPacket () from /usr/lib/librtmp.so.0
#9  0xb6e6bde2 in RTMP_Write () from /usr/lib/librtmp.so.0
#10 0xb7d757d7 in retry_transfer_wrapper (h=0x8599000, buf=0x85a3500 "\b",
size=544) at libavformat/avio.c:271
#11 ffurl_write (h=0x8599000, buf=0x85a3500 "\b", size=544) at
#12 0xb7d75e72 in flush_buffer (s=0x85a3220) at libavformat/aviobuf.c:127
#13 0xb7d7690f in avio_flush (s=0x85a3220) at libavformat/aviobuf.c:179
#14 0xb7d89066 in flv_write_packet (s=0x85951a0, pkt=0x851b2c4) at
#15 0xb7e179e0 in av_write_frame (s=0x85951a0, pkt=0x851b2c4) at


Is there an easy way to get around this, for me it would be best if librtmp
would simply return an error from the RTMP_Write Call.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20111024/dd443576/attachment.html>

More information about the rtmpdump mailing list