[rtmpdump] librtmp infinite loop

Steve McFarlin steve at stevemcfarlin.com
Fri Dec 24 23:40:32 CET 2010


On Dec 24, 2010, at 2:32 PM, Howard Chu wrote:

> Steve McFarlin wrote:
>> 
>> On Dec 24, 2010, at 2:11 PM, Steve McFarlin wrote:
>> 
>>> Hello,
>>> 
>>> platform: darwin - iphone
>>> librtmp ver: latest package download and integrated into FFmpeg
>>> Setup: RTMP publish to server
>>> 
>>> Problem:
>>> 
>>> If the connection to the remote server is closed a SIGPIPE is raised. It is at this point librtmp will enter into an infinite loop. The loop trace is as follows (some error logs were added by me).
>>> 
>>> ERROR: WriteN, RTMP send error 32 (43 bytes)
>>> RTMP_Close
>>> RTMP_Close - Still connected
>>> SendFCUnpublish
>>> RTMP_SendPacket
>>> ERROR: WriteN, RTMP send error 32 (43 bytes)
>>> RTMP_Close
>>> RTMP_Close - Still connected
>>> SendFCUnpublish
>>> RTMP_SendPacket
>>> ERROR: WriteN, RTMP send error 32 (43 bytes)
>>> RTMP_Close
>>> RTMP_Close - Still connected
>>> ....
>>> 
>>> 
>>> This will go on forever. I am currently investigating why this occurs. I will update if I find why.
> 
>> Simply adding the following code to rtmp.c::WriteN fixes the issue.
>> 
>> if (sockerr == EPIPE) {
>>     r->m_sb.sb_socket = -1;
>> }
>> 
> That will leak the descriptor. I'll commit a fix shortly.

Ahh I see the leak. Thanks for the quick patch.


More information about the rtmpdump mailing list