After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 638914 - Stopping and starting multiple time leaks resources
Stopping and starting multiple time leaks resources
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other All
: Normal normal
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-07 15:15 UTC by Jonas Larsson
Modified: 2012-11-16 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jonas Larsson 2011-01-07 15:15:14 UTC
In my setting I must be able to totally deinitialize the server when not in use to conserve resources (embedded in Android app). Simply unreffing the server doesn't help. It doesn't close it's listening socket, so when started the next time the listening port is already in use. The server also has refs to GIOChannel and GSource which are never unreffed from what I can see.

For now, I've added code close the listening socket and unref GIOChannel and GSource in gst_rtsp_server_finalize. It seems to work, but I'm a glib noob, so I could be horribly wrong.

The caller of gst_rtsp_server_attach is responsible for detaching the server from its context. If not done, GIOChannel and GSource will be left with ref_count 1.

My updated gst_rtsp_server_finalize:

static void
gst_rtsp_server_finalize (GObject * object)
{
  GstRTSPServer *server = GST_RTSP_SERVER (object);

  g_free (server->address);
  g_free (server->service);

  g_object_unref (server->session_pool);
  g_object_unref (server->media_mapping);

  if (server->io_watch)
    g_source_unref (server->io_watch);
  if (server->io_channel)
    g_io_channel_unref (server->io_channel);
  if (server->server_sock.fd >= 0)
    close (server->server_sock.fd);
}
Comment 1 Wim Taymans 2011-01-12 15:43:07 UTC
for starters, it was missing a parent call to finalize.

commit 0ef53a2d4f2db0ab6d5361971da53e39b0734dba
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Jan 12 16:38:34 2011 +0100

    server: chain up to the parent finalize
Comment 2 Wim Taymans 2011-01-12 17:34:51 UTC
I added some more fixes. There is also an example for doing proper cleanup`in tests/test-cleanup.c
Comment 3 Wim Taymans 2012-11-16 11:32:51 UTC
assuming it's fixed