[Bug 663944] New: souphttpsrc leaking file descriptors + memory when destroyed while connecting
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Sat Nov 12 16:49:20 PST 2011
https://bugzilla.gnome.org/show_bug.cgi?id=663944
GStreamer | gst-plugins-good | git
Summary: souphttpsrc leaking file descriptors + memory when
destroyed while connecting
Classification: Platform
Product: GStreamer
Version: git
OS/Version: Linux
Status: UNCONFIRMED
Severity: major
Priority: Normal
Component: gst-plugins-good
AssignedTo: gstreamer-bugs at lists.freedesktop.org
ReportedBy: erdizz at mail.ru
QAContact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
souphttpsrc leaks fds and libsoup objects when the following contions are met:
1. connetion to a server is in progress (not established yet);
2. the pipeline is switched to NULL state and then destroyed.
There's almost 100% chance of hitting this when destroying the pipeline while
the server is not responding. My video server runs into max open fds limit in 3
hours when a single MJPEG source goes down because of this bug.
It appears to me that the problem is in how souphttpsrc handles its separate
main context. It creates a new main context and passes it to libsoup, which
passes it to GIO. When the element is destroyed, the context goes away
immediately (that's how I see it - may be wrong). But GIO depends on the
context for freeing resources associated with the connection. Cancellable
object uses the context to initiate cancellation, which leads to destruction of
related objects and fds. My guess is that the context is destroyed early and
that's why GIO cancellation doesn't work, which results in several file
descriptors leaked and unfreed libsoup and GIO objects.
The following patch makes resource leaks go away, which proves the point.
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index 3011058..2f03c8d 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -1267,7 +1267,7 @@ gst_soup_http_src_start (GstBaseSrc * bsrc)
if (src->proxy == NULL) {
src->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
- src->context, SOUP_SESSION_USER_AGENT, src->user_agent,
+ /* src->context */ g_main_context_default(), SOUP_SESSION_USER_AGENT,
src->user_agent,
SOUP_SESSION_TIMEOUT, src->timeout,
#ifdef HAVE_LIBSOUP_GNOME
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
@@ -1276,7 +1276,7 @@ gst_soup_http_src_start (GstBaseSrc * bsrc)
} else {
src->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
- src->context, SOUP_SESSION_PROXY_URI, src->proxy,
+ /* src->context */ g_main_context_default(), SOUP_SESSION_PROXY_URI,
src->proxy,
SOUP_SESSION_TIMEOUT, src->timeout,
SOUP_SESSION_USER_AGENT, src->user_agent, NULL);
}
--
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