[Bug 688852] New: udpsrc recvfrom() block fix
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Wed Nov 21 22:27:40 PST 2012
https://bugzilla.gnome.org/show_bug.cgi?id=688852
GStreamer | gst-plugins-good | 0.10.36
Summary: udpsrc recvfrom() block fix
Classification: Platform
Product: GStreamer
Version: 0.10.36
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: gst-plugins-good
AssignedTo: gstreamer-bugs at lists.freedesktop.org
ReportedBy: v.markovtsev at samsung.com
QAContact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
gst/udp/gstudpsrc.c, near line 495:
/* If we get here and the readsize is zero, then either select was woken up
* by activity that is not a read, or a poll error occurred, or a UDP packet
* was received that has no data. Since we cannot identify which case it is,
* we handle all of them. This could possibly lead to a UDP packet getting
* lost, but since UDP is not reliable, we can accept this. */
if (G_UNLIKELY (!readsize)) {
/* try to read a packet (and it will be ignored),
* in case a packet with no data arrived */
slen = sizeof (sa);
recvfrom (udpsrc->sock.fd, (char *) &slen, 0, 0, &sa.sa, &slen);
/* clear any error, in case a poll error occurred */
clear_error (udpsrc);
/* poll again */
goto retry;
}
If a poll error occurs (for example, connection is lost), recvfrom() sometimes
blocks on recvfrom() forever. Since LIVE_LOCK() is previously taken, any
attempt to set udpsrc state from PLAYING to PAUSED hangs on LIVE_LOCK() then.
This prevents from successful destroying of udpsrc when the other end dies at
the same time (this deadlock floats, sometimes it happens and sometimes
everything's OK).
I suggest to add MSG_DONTWAIT to flags, so that in case of errors that would
block recvfrom(), it goes on without blocking:
recvfrom (udpsrc->sock.fd, (char *) &slen, 0, MSG_DONTWAIT, &sa.sa, &slen)
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list