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 761844 - rtsp-server: tls client socket leaks when using new main context
rtsp-server: tls client socket leaks when using new main context
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-11 00:01 UTC by Aleix Conchillo Flaqué
Modified: 2018-11-03 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test-video with different main context (1.34 KB, patch)
2016-02-11 00:01 UTC, Aleix Conchillo Flaqué
rejected Details | Review
no socket leak ref/unref stack traces (18.47 KB, text/plain)
2016-02-11 00:04 UTC, Aleix Conchillo Flaqué
  Details
socket leak ref/unref stack traces (17.56 KB, text/plain)
2016-02-11 00:05 UTC, Aleix Conchillo Flaqué
  Details

Description Aleix Conchillo Flaqué 2016-02-11 00:01:06 UTC
Created attachment 320835 [details] [review]
test-video with different main context

I've updated our streaming server to use GStreamer 1.6.3 (gst-rtsp-server 1.6.2), glib 2.46.2 and glib-networking 2.46.1.

There's an RTSP TLS socket leak for the socket used to communicate back with the client.

The leak only happens occurs if a different GMainContext is used. I'm attaching a patch for the examples/test-video.c.

Once the server is running just run a client with:

$ gst-launch-1.0 rtspsrc location=rtsps://user:password@127.0.0.1:8554/test tls-validation-flags=0 ! fakesink silent=false -v

lsof will show the leaks.

This worked before with GStreamer 1.4.5, glib 2.42.0 and glib-networking 2.42.0
Comment 1 Aleix Conchillo Flaqué 2016-02-11 00:04:27 UTC
Created attachment 320836 [details]
no socket leak ref/unref stack traces

Stack traces for all the g_object_ref/unref. This is with the problem fixed (using main context).
Comment 2 Aleix Conchillo Flaqué 2016-02-11 00:05:00 UTC
Created attachment 320837 [details]
socket leak ref/unref stack traces

Stack traces for all the g_object_ref/unref. One g_object_unref missing.
Comment 3 Aleix Conchillo Flaqué 2016-02-11 00:10:43 UTC
Also, this is from valgrind with --track-fds=yes.

It is from my application but it shows where the socket leak comes from.

==29769== Open AF_INET socket 16: 127.0.0.1:8554 <-> unbound
==29769==    at 0x566E05D: ??? (syscall-template.S:81)
==29769==    by 0x7A6FD0F: g_socket_accept (gsocket.c:2258)
==29769==    by 0x74B46DE: gst_rtsp_connection_accept (gstrtspconnection.c:446)
==29769==    by 0x728CFC6: gst_rtsp_server_io_func (rtsp-server.c:1169)
==29769==    by 0x7A6DD70: socket_source_dispatch (gsocket.c:3284)
==29769==    by 0x8036B19: g_main_dispatch (gmain.c:3154)
==29769==    by 0x8036B19: g_main_context_dispatch (gmain.c:3769)
==29769==    by 0x8036EDF: g_main_context_iterate.isra.29 (gmain.c:3840)
==29769==    by 0x8037201: g_main_loop_run (gmain.c:4034)
==29769==    by 0x4E9CD29: thread_func(void*) (XXXXXXXX.C:374)
==29769==    by 0x56656A9: start_thread (pthread_create.c:333)
==29769==    by 0x5982EEC: clone (clone.S:109)
==29769==
Comment 4 Sebastian Dröge (slomo) 2016-02-17 14:28:21 UTC
Aleix, did you succeed with creating a patch for this?
Comment 5 Aleix Conchillo Flaqué 2016-02-17 19:30:00 UTC
(In reply to Sebastian Dröge (slomo) from comment #4)
> Aleix, did you succeed with creating a patch for this?

No, what I did is use the default main context in my server instead of using a new one.

I'll try to find some time to debug this. I'm curious to see where the problem is. My guts tell me it's in glib, but it's just a guess.
Comment 6 Tim-Philipp Müller 2016-06-20 12:15:04 UTC
Aleix, did you have any chance to look into this again?
Comment 7 Aleix Conchillo Flaqué 2016-06-21 08:36:36 UTC
No, no time. We are swamped. Last week we made it pushing the srtp related ones, even not planned. Yesterday, I flew to Barcelona so I'm going to spend a few weeks working with Josep. Not sure if we will have time for this though.

May be there's even a chance that something got fixed in glib.... ?

I'll at least try it in a few days and see if it's still reproducible.
Comment 8 Tim-Philipp Müller 2018-01-15 15:37:30 UTC
This still seems to be a problem. I can reproduce this.

The test example is leaking some things that should be unrefed (server, loop, context) as well, but even then I get this socket fd leak.

Strangely enough it seems to only leak the fd itself but I don't get leaks for any socket objects/structs reported in valgrind.
Comment 9 GStreamer system administrator 2018-11-03 15:39:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/20.