[Live-devel] bug in BasicTaskScheduler.cpp ?

Sigismondo Boschi s.boschi at totalwire.it
Mon Nov 10 09:45:11 PST 2008


Hi Ross,

I have an application, written with live555, that needs to play 
continuously from an rtsp source using RTP-over-TCP. This worked fine 
with an old version of the library, but upgrading to the last one (I 
have seen many bugs solved in the mailing list), it stops restarting 
after a few BYEs (1 to 5).

I have debugged this problem, here are the outcomes.

The application works by setting up a BYE handler thats restart the RTSP 
client.

The restart routine can not be called directly, because the RTCP handler 
is destroyed on the destruction of the RTSP session, so I have called it 
asynchronously in the event loop with 
scheduleDelayedTask(0,restartTask,data)

What was happening is this:

restartTask is being called in the middle of 
BasicTaskScheduler::SingleStep(), by fDelayQueue.handleAlarm()
after selecting among all the available sockets, and so "fd_set readSet" 
now points to the one socket that was available for reading *BEFORE* 
restarting.

On the other side restartTask has closed such socket and opened new 
ones. Windowze sometimes reuse the same socket numbers, so if the socket 
actually exists, and can not be what it was in the first select (the TCP 
good socket), what is called is the UDP data handler - where nothing 
comes since all the traffic goes over TCP: the handler get stuck in the 
select.

And so the taskscheduler stop working being blocked in one select.

I have solved the problem moving fDelayQueue.handleAlarm() to the very 
end of the procedure. Now it works fine, since "readSet" is not used 
anymore.

Only doubt, if there is some reason it is there in the middle, how 
should I have dealt with such case? The only other solution coming in my 
mind, without patching the library is to stop the event loop, restart 
the client and then restart the event loop.

Thanks for the great work on the library.

Regards,
    Sigismondo









-- 
------------------------------------------------------------------
Sigismondo Boschi, PhD                     TotalWire S.r.l.
s.boschi at totalwire.it                      http://www.totalwire.it
cell: +39 346 7911896                      tel:  +39 051 302696
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s_boschi.vcf
Type: text/x-vcard
Size: 275 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20081110/4eaa25dd/attachment.vcf>


More information about the live-devel mailing list