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 708667 - rtspconnection: leaks file descriptors/child sources
rtspconnection: leaks file descriptors/child sources
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.2.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-24 09:55 UTC by Ognyan Tonchev (redstar_)
Modified: 2013-09-24 15:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Only create writesrc when it is actually needed (3.52 KB, patch)
2013-09-24 09:58 UTC, Ognyan Tonchev (redstar_)
committed Details | Review

Description Ognyan Tonchev (redstar_) 2013-09-24 09:55:00 UTC
When watch->writesrc is not attached to a context it's child sources will never be freed. The gsource api in glib looks a bit weird, it only removes child sources from g_source_destroy and only if the source is attached to a context.

The problem can be reproduced in different ways, for example:

run the gst-rtsp-server unit tests: GST_CHECKS=test_play_smpte_range make gst/rtspserver.valgrind

or

one of the examples in gst-rtsp-server: ./test-mp4 some.m4v (1 fd is leaked for every RTSP session)

I am also going to write a unit test for rtspconnection.c which triggers the problem and attach it to this report.
Comment 1 Ognyan Tonchev (redstar_) 2013-09-24 09:58:04 UTC
Created attachment 255614 [details] [review]
Only create writesrc when it is actually needed

Proposing a patch which only creates writesrc when it is needed and right before attaching it to a context (by adding it as a child source to watch)
Comment 2 Sebastian Dröge (slomo) 2013-09-24 10:10:56 UTC
commit 8ba90931aed21edd44ddda515665312e49c6b088
Author: Ognyan Tonchev <ognyan@axis.com>
Date:   Tue Sep 24 12:10:00 2013 +0200

    rtspconnection: Only create writesrc when it is actually needed
    
    Creating a GSource and not attaching it to a context will cause
    a leak of it's child sources. That is why we create writesrc right
    before attaching it to a context.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708667