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 727231 - rtsp-server: The media streams leak
rtsp-server: The media streams leak
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other All
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-03-28 11:27 UTC by Linus Svensson
Modified: 2014-04-08 13:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unblock the stream objects in unprepare (4.12 KB, patch)
2014-04-02 08:50 UTC, Linus Svensson
committed Details | Review
cleanup threadpools (1.23 KB, patch)
2014-04-02 08:51 UTC, Linus Svensson
committed Details | Review

Description Linus Svensson 2014-03-28 11:27:38 UTC
The stream objects leak if you only send a SETUP request in a streaming session. This can easily be reproduced by the following steps:
1) connect to an RTSP server
2) send a SETUP request
3) close the connection.

This error only occurs when just the SETUP (doesn't matter if you only send SETUP for one or more streams) is called. If a DESCRIBE request is sent before the SETUP there is no problem. It's not a problem if you send a PLAY request after the SETUP either.
Comment 1 Linus Svensson 2014-04-01 07:37:41 UTC
The problem is that the src pads of the rtsp bin becomes blocked when prerolling a live media. The pads are blocked from the stream objects in gst_rtsp_stream_set_blocked. The blocking probe gets a a reference to the stream object as user data. 

When closing the connection when only a SETUP for a live media has been sent, the src pads are still blocked and holds a reference to a stream object. The stream object holds a reference to the src pads as well.

Neither the pads or stream will be finalized in this case.
Comment 2 Linus Svensson 2014-04-02 08:50:41 UTC
Created attachment 273454 [details] [review]
Unblock the stream objects in unprepare

Extended the unit test to also test with a live media.

When running the unit tests without the change in rtsp-media.c, it is obvious that the stream objects are not freed. Valgrind does, however, not complain about any leaks. I suspect that the reason is that the stream object holds a reference to the src pad and the src pad holds a reference to the stream object.
Comment 3 Linus Svensson 2014-04-02 08:51:37 UTC
Created attachment 273455 [details] [review]
cleanup threadpools
Comment 4 Wim Taymans 2014-04-08 13:02:37 UTC
commit 6916875a0b31bc2484cb16613813974348ba068c
Author: Linus Svensson <linussn@axis.com>
Date:   Tue Apr 1 16:55:13 2014 +0200

    media test: cleanup the thread pool in tests

commit a3e6b11f11e18f2d67cffafdd65a51f47cd7b64f
Author: Linus Svensson <linussn@axis.com>
Date:   Tue Apr 1 13:16:26 2014 +0200

    rtsp-media: Unblock blocked streams in unprepare
    
    The streams will be blocked when a live media is prepared.
    The streams should be unblocked in gst_rtsp_media_unprepare.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727231