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 690142 - memory leak on auth
memory leak on auth
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: HTTP Transport
2.38.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2012-12-13 08:10 UTC by Nicola
Modified: 2013-02-04 10:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for 2.38.1 (541 bytes, text/plain)
2013-02-04 10:34 UTC, Nicola
Details

Description Nicola 2012-12-13 08:10:12 UTC
here is the valgrind output with 2.38 on ubuntu precise (libsoup is used by souphttpsrc gstreamer element)

==5551== 5 bytes in 1 blocks are definitely lost in loss record 87 of 5,889
==5551==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5551==    by 0x55C1A78: g_malloc (gmem.c:159)
==5551==    by 0x55D62DD: g_strdup (gstrfuncs.c:356)
==5551==    by 0x10195DAC: authenticate (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x101947A6: soup_auth_authenticate (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x101991AB: authenticate_auth (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x5334CA1: g_closure_invoke (gclosure.c:777)
==5551==    by 0x5345D70: signal_emit_unlocked_R (gsignal.c:3547)
==5551==    by 0x534E098: g_signal_emit_valist (gsignal.c:3296)
==5551==    by 0x534E241: g_signal_emit (gsignal.c:3352)
==5551==    by 0x101B2CEF: io_read (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x5334EC9: _g_closure_invoke_va (gclosure.c:840)
==5551==    by 0x534D740: g_signal_emit_valist (gsignal.c:3207)
==5551==    by 0x534E241: g_signal_emit (gsignal.c:3352)
==5551==    by 0x101C10BD: socket_read_watch (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x55BBD52: g_main_context_dispatch (gmain.c:2539)
==5551==    by 0x55BC09F: g_main_context_iterate.isra.23 (gmain.c:3146)
==5551==    by 0x55BC499: g_main_loop_run (gmain.c:3340)
==5551==    by 0xFB38037: gst_soup_http_src_create (in /usr/lib/x86_64-linux-gnu/gstreamer-0.10/libgstsouphttpsrc.so)
==5551==    by 0x6DDF1C7: ??? (in /usr/lib/x86_64-linux-gnu/libgstbase-0.10.so.0.30.0)
==5551== 

==5551== 37 bytes in 1 blocks are definitely lost in loss record 2,885 of 5,889
==5551==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5551==    by 0x55C1A78: g_malloc (gmem.c:159)
==5551==    by 0x5593414: g_base64_encode (gbase64.c:269)
==5551==    by 0x10195D94: authenticate (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x101947A6: soup_auth_authenticate (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x101991AB: authenticate_auth (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x5334CA1: g_closure_invoke (gclosure.c:777)
==5551==    by 0x5345D70: signal_emit_unlocked_R (gsignal.c:3547)
==5551==    by 0x534E098: g_signal_emit_valist (gsignal.c:3296)
==5551==    by 0x534E241: g_signal_emit (gsignal.c:3352)
==5551==    by 0x101B2CEF: io_read (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x5334EC9: _g_closure_invoke_va (gclosure.c:840)
==5551==    by 0x534D740: g_signal_emit_valist (gsignal.c:3207)
==5551==    by 0x534E241: g_signal_emit (gsignal.c:3352)
==5551==    by 0x101C10BD: socket_read_watch (in /usr/lib/x86_64-linux-gnu/libsoup-2.4.so.1.5.0)
==5551==    by 0x55BBD52: g_main_context_dispatch (gmain.c:2539)
==5551==    by 0x55BC09F: g_main_context_iterate.isra.23 (gmain.c:3146)
==5551==    by 0x55BC499: g_main_loop_run (gmain.c:3340)
==5551==    by 0xFB38037: gst_soup_http_src_create (in /usr/lib/x86_64-linux-gnu/gstreamer-0.10/libgstsouphttpsrc.so)
==5551==    by 0x6DDF1C7: ??? (in /usr/lib/x86_64-linux-gnu/libgstbase-0.10.so.0.30.0)

dpkg -l | grep libsoup2.4
ii  libsoup2.4-1                                      2.38.1-1                                 HTTP library implementation in C -- Shared library
ii  libsoup2.4-1:i386                                 2.38.1-1                                 HTTP library implementation in C -- Shared library
ii  libsoup2.4-dbg                                    2.38.1-1                                 HTTP library implementation in C -- debugging symbols
ii  libsoup2.4-dev                                    2.38.1-1                                 HTTP library implementation in C -- Development files
ii  libsoup2.4-doc                                    2.38.1-1                                 HTTP library implementation in C -- API Reference
Comment 1 Nicola 2012-12-13 08:13:39 UTC
the only relevant commit since 2.38.1 is this:

http://git.gnome.org/browse/libsoup/commit/?id=dbc41f65f80336052f57a2e3cfb48163a2a6185a

but the leak fixed seems unrelated to the one posted
Comment 2 Dan Winship 2012-12-14 17:27:20 UTC
There is definitely not a leak in the place that trace points out.

Most likely, gst is reffing the SoupAuth and then forgetting to unref it later, causing the entire SoupAuth to be leaked.
Comment 3 Nicola 2012-12-14 18:29:23 UTC
Thanks, I'm looking at gstreamer code, the leak happen only when I use an url as:

http://username:password@....

gstreamer souphttpsrc has separate props for credential too (user-id, user-pw) if I use this way to pass credential the auth callback is called and no leak happen:

http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/ext/soup/gstsouphttpsrc.c?h=0.10#n703

at a first look souphttpsrc seems to simply pass the url to libsoup when auth is embedded in the url (the auth callback is not called in this case), so no leak in gstreamer seems possibile, however I'm doing some more tests
Comment 4 Dan Winship 2012-12-15 14:03:46 UTC
oops, I was looking at the Basic auth code, but it looks like there might be a leak in Digest auth
Comment 5 Nicola 2012-12-15 15:56:26 UTC
yes, I'm using digest auth
Comment 6 Dan Winship 2013-01-12 14:49:12 UTC
fixed in git. (The leak should only happen if you call
soup_auth_authenticate() when the auth is already authenticated, so
this may point to a minor bug in gstreamer (eg, it's authenticating
the auth twice).
Comment 7 Nicola 2013-02-04 10:34:58 UTC
Created attachment 235136 [details]
patch for 2.38.1

Thanks! it is fine now, attached the patch for 2.38.1 (debian testing/ubuntu version)