GNOME Bugzilla – Bug 666711
rtspsrc: hostname lookup is not thread safe
Last modified: 2012-01-07 20:55:53 UTC
Created attachment 204080 [details] the pipeline we use rtspsrc to get video streams from ip cameras. in case we've a fast machine and enough memory we found this bug with about 30 rtspsrc started parallel at the same time to different ip cameras. it's turn out that some stream are changed. this means that eg: pipeline 12 show camera 10's video. after a long debugging we found the problem what you can see the attached picture of the pipeline. the ip address is not the same in the rtspsrc's location argument what is inside the rtspsrc's inner udpsink's ip address (actually another ip address in the same network among the 30 cameras which we start to record at the same time). so it seems rtspsrc is not tread safe. and during the inner udpsrc generation the system can mix the internal structures and use wrong ip address (if from another rtspsrc's locataion). of course each ip camera working properly and always send back his own ip address during the rtsp communication. so the problem is not that the camera send different ip address during the SETUP phase then the location in the rtsp.
it seems that in the gstrtspconnection.c line 473:getaddrinfo 485:getnameinfo these two functions are not thread safe. so that can be the core reason of the problem.
I hope this fixes it. If not, please re-open. commit 9f042ae224b3d84643bf4ad977080987fe80d36f Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Sat Jan 7 20:12:17 2012 +0000 rtspconnection: make hostname lookup more thread-safe Don't write IP number string to return into a static array which is shared amongst all threads (note: of course a copy is returned). https://bugzilla.gnome.org/show_bug.cgi?id=666711
it seems to a good catch:-) better the our tipp. anyway in the light of this fix, it'd be very thread safe to check and remove all local static variable in all functions...