Bug 95335 - leak due spice-widget-egl -> eglInitialize
Summary: leak due spice-widget-egl -> eglInitialize
Status: RESOLVED MOVED
Alias: None
Product: Spice
Classification: Unclassified
Component: spice-gtk (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Spice Bug List
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-10 08:26 UTC by Victor Toso
Modified: 2018-06-03 10:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Victor Toso 2016-05-10 08:26:31 UTC
Leak is:
==30366== 72,704 bytes in 1 blocks are definitely lost in loss record 9,971 of 9,978
==30366==    at 0x4C28BF6: malloc (vg_replace_malloc.c:299)
==30366==    by 0x3962AEDF: ???
==30366==    by 0x400F749: call_init.part.0 (dl-init.c:72)
==30366==    by 0x400F85A: call_init (dl-init.c:30)
==30366==    by 0x400F85A: _dl_init (dl-init.c:120)
==30366==    by 0x40143B1: dl_open_worker (dl-open.c:564)
==30366==    by 0x400F5F3: _dl_catch_error (dl-error.c:187)
==30366==    by 0x40136B2: _dl_open (dl-open.c:649)
==30366==    by 0xC45EFC8: dlopen_doit (dlopen.c:66)
==30366==    by 0x400F5F3: _dl_catch_error (dl-error.c:187)
==30366==    by 0xC45F630: _dlerror_run (dlerror.c:163)
==30366==    by 0xC45F060: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
==30366==    by 0xF0073B5: dri2_open_driver.isra.7 (egl_dri2.c:452)

Tracking this with gdb:
Breakpoint 1, dri2_open_driver (disp=0xadfee0) at drivers/dri2/egl_dri2.c:419
419	dri2_open_driver(_EGLDisplay *disp)
(gdb) bt
#0  dri2_open_driver (disp=0xadfee0) at drivers/dri2/egl_dri2.c:419
#1  0x00007fffed9ff092 in dri2_load_driver_dri3 (disp=disp@entry=0xadfee0) at drivers/dri2/egl_dri2.c:508
#2  0x00007fffeda01e77 in dri2_initialize_x11_dri3 (drv=<optimized out>, disp=0xadfee0) at drivers/dri2/platform_x11.c:1292
#3  dri2_initialize_x11 (drv=<optimized out>, disp=0xadfee0) at drivers/dri2/platform_x11.c:1464
#4  0x00007fffed9fb8ff in _eglMatchAndInitialize (dpy=0xadfee0) at main/egldriver.c:261
#5  0x00007fffed9fb9b9 in _eglMatchDriver (dpy=dpy@entry=0xadfee0, test_only=test_only@entry=0) at main/egldriver.c:292
#6  0x00007fffed9f7d32 in eglInitialize (dpy=0xadfee0, major=0x7fffffffb67c, minor=0x7fffffffb680) at main/eglapi.c:482
#7  0x00007ffff7599cb7 in spice_egl_init (display=display@entry=0xaa0440, err=err@entry=0x7fffffffb6c0) at spice-widget-egl.c:226
#8  0x00007ffff75938d6 in drawing_area_realize (area=0x6ab3b0, user_data=<optimized out>) at spice-widget.c:571

Looking at khronos docs, eglInitialize [0] says that we must eglTerminate [1] to release resources, which we do. eglTerminate docs also says:

> (...) they are not released until they are no longer current as a result of
> eglMakeCurrent.

but we are calling eglMakeCurrent correctly just before eglTerminate... so I guess it could be some race conditions that makes dlclose() nerver be called?

[0] https://www.khronos.org/registry/egl/sdk/docs/man/html/eglInitialize.xhtml
[1] https://www.khronos.org/registry/egl/sdk/docs/man/html/eglTerminate.xhtml
Comment 1 Marc-Andre Lureau 2016-05-10 08:49:23 UTC
if you could write a small reproducer (without gtk?) that would be helpful to move this bug to mesa. But I am afraid they will just close as wontfix.
Comment 2 Frediano Ziglio 2016-08-01 17:02:53 UTC
Actually in spice-gtk we have a call to eglInitialize but not to eglTerminate. Perhaps we should call it.
Comment 3 Victor Toso 2016-08-01 17:20:44 UTC
(In reply to Frediano Ziglio from comment #2)
> Actually in spice-gtk we have a call to eglInitialize but not to
> eglTerminate. Perhaps we should call it.

I've included it: https://cgit.freedesktop.org/spice/spice-gtk/commit/?id=181ec2511902483df5c02ecf12db437d9975a53b

And it was removed: https://cgit.freedesktop.org/spice/spice-gtk/commit/?id=8873ff3de67671a72468b0da3e5285dcc070af5c
Comment 4 GitLab Migration User 2018-06-03 10:21:15 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/spice/spice-gtk/issues/23.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.