Bug 68157

Summary: Valgrind error on shutdown
Product: Wayland Reporter: Rob Bradford <rob>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: janarne
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: destroy input_method_binding
valgrind log after applying patch

Description Rob Bradford 2013-08-15 16:28:47 UTC
When running with the RDP backend (which removes and adds seats) the following valgrind error occurs on shutdown:

valgrind shows:
==6506== Invalid read of size 8
==6506==    at 0x419F89: unbind_input_method (text-backend.c:743)
==6506==    by 0x4E3AA8D: destroy_resource (wayland-server.c:434)
==6506==    by 0x4E407B9: for_each_helper (wayland-util.c:353)
==6506==    by 0x4E407F5: wl_map_for_each (wayland-util.c:359)
==6506==    by 0x4E3ADA5: wl_client_destroy (wayland-server.c:574)
==6506==    by 0x41A4E8: text_backend_notifier_destroy (text-backend.c:931)
==6506==    by 0x408EE8: wl_signal_emit (wayland-server.h:171)
==6506==    by 0x41058D: main (compositor.c:3429)
==6506==  Address 0x8825a30 is 112 bytes inside a block of size 120 free'd
==6506==    at 0x4C2AF7C: free (vg_replace_malloc.c:446)
==6506==    by 0x41A111: input_method_notifier_destroy (text-backend.c:797)
==6506==    by 0x4106A8: wl_signal_emit (wayland-server.h:171)
==6506==    by 0x413DE5: weston_seat_release (input.c:1573)
==6506==    by 0x88343B3: rdp_peer_context_free (compositor-rdp.c:603)
==6506==    by 0x883445D: rdp_client_activity (compositor-rdp.c:622)
==6506==    by 0x4E3C967: wl_event_source_fd_dispatch (event-loop.c:86)
==6506==    by 0x4E3D318: wl_event_loop_dispatch (event-loop.c:421)
==6506==    by 0x4E3B615: wl_display_run (wayland-server.c:836)
==6506==    by 0x41056C: main (compositor.c:3423)
==6506== 
==6506== Invalid write of size 8
==6506==    at 0x419F95: unbind_input_method (text-backend.c:745)
==6506==    by 0x4E3AA8D: destroy_resource (wayland-server.c:434)
==6506==    by 0x4E407B9: for_each_helper (wayland-util.c:353)
==6506==    by 0x4E407F5: wl_map_for_each (wayland-util.c:359)
==6506==    by 0x4E3ADA5: wl_client_destroy (wayland-server.c:574)
==6506==    by 0x41A4E8: text_backend_notifier_destroy (text-backend.c:931)
==6506==    by 0x408EE8: wl_signal_emit (wayland-server.h:171)
==6506==    by 0x41058D: main (compositor.c:3429)
==6506==  Address 0x88259c0 is 0 bytes inside a block of size 120 free'd
==6506==    at 0x4C2AF7C: free (vg_replace_malloc.c:446)
==6506==    by 0x41A111: input_method_notifier_destroy (text-backend.c:797)
==6506==    by 0x4106A8: wl_signal_emit (wayland-server.h:171)
==6506==    by 0x413DE5: weston_seat_release (input.c:1573)
==6506==    by 0x88343B3: rdp_peer_context_free (compositor-rdp.c:603)
==6506==    by 0x883445D: rdp_client_activity (compositor-rdp.c:622)
==6506==    by 0x4E3C967: wl_event_source_fd_dispatch (event-loop.c:86)
==6506==    by 0x4E3D318: wl_event_loop_dispatch (event-loop.c:421)
==6506==    by 0x4E3B615: wl_display_run (wayland-server.c:836)
==6506==    by 0x41056C: main (compositor.c:3423)

Copied from https://bugs.freedesktop.org/show_bug.cgi?id=67231 (about a different but similar issue)
Comment 1 Rob Bradford 2013-08-15 16:30:10 UTC
Jan, can you look into this?
Comment 2 Jan Arne Petersen 2013-08-21 13:28:44 UTC
Created attachment 84391 [details] [review]
destroy input_method_binding

I could not test it, but from the code and valgrind log it seems to be something like this.
Comment 3 Mariusz Ceier 2013-08-21 16:05:21 UTC
Created attachment 84396 [details]
valgrind log after applying patch

I tested attached patch with git master, and it seems to at least remove "Invalid read of size 8" in unbind_input_method, but it doesn't remove "Invalid read of size 8" triggered by wl_client_destroy.

Attached current valgrind log.

==6992== Invalid read of size 8
==6992==    at 0x4E3A061: wl_signal_emit (wayland-server.h:170)
==6992==    by 0x4E3AFA6: wl_client_destroy (wayland-server.c:600)
==6992==    by 0x41A8DF: text_backend_notifier_destroy (text-backend.c:934)
==6992==    by 0x409078: wl_signal_emit (wayland-server.h:171)
==6992==    by 0x410856: main (compositor.c:3463)
==6992==  Address 0xd49a0e8 is 120 bytes inside a block of size 144 free'd
==6992==    at 0x4C2AF7C: free (vg_replace_malloc.c:446)
==6992==    by 0x4E3B01B: wl_client_destroy (wayland-server.c:608)
==6992==    by 0x4E3A5AC: wl_client_connection_data (wayland-server.c:244)
==6992==    by 0x4E3CD5B: wl_event_source_fd_dispatch (event-loop.c:86)
==6992==    by 0x4E3D70C: wl_event_loop_dispatch (event-loop.c:421)
==6992==    by 0x4E3B860: wl_display_run (wayland-server.c:869)
==6992==    by 0x410835: main (compositor.c:3457)
==6992==

==6992== Invalid read of size 8
==6992==    at 0x4E3A06D: wl_signal_emit (wayland-server.h:170)
==6992==    by 0x4E3AFA6: wl_client_destroy (wayland-server.c:600)
==6992==    by 0x41A8DF: text_backend_notifier_destroy (text-backend.c:934)
==6992==    by 0x409078: wl_signal_emit (wayland-server.h:171)
==6992==    by 0x410856: main (compositor.c:3463)
==6992==  Address 0xd49a0e8 is 120 bytes inside a block of size 144 free'd
==6992==    at 0x4C2AF7C: free (vg_replace_malloc.c:446)
==6992==    by 0x4E3B01B: wl_client_destroy (wayland-server.c:608)
==6992==    by 0x4E3A5AC: wl_client_connection_data (wayland-server.c:244)
==6992==    by 0x4E3CD5B: wl_event_source_fd_dispatch (event-loop.c:86)
==6992==    by 0x4E3D70C: wl_event_loop_dispatch (event-loop.c:421)
==6992==    by 0x4E3B860: wl_display_run (wayland-server.c:869)
==6992==    by 0x410835: main (compositor.c:3457)
==6992==
Comment 4 GitLab Migration User 2018-06-08 23:51:34 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/wayland/weston/issues/30.

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.