Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on touch event #54

Closed
msrd0 opened this issue Apr 7, 2020 · 11 comments
Closed

Segmentation fault on touch event #54

msrd0 opened this issue Apr 7, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@msrd0
Copy link

msrd0 commented Apr 7, 2020

After #50 was merged, I wanted to try out the new feature and compiled the git version on my laptop. However, as soon as I touch the touchscreen after I started slurp, I get a segmentation fault. Unfortunately I don't know how to produce a proper backtrace since I can't type bt while slurp is still in front of my entire screen. This is the best I've gotten by killing slurp from another tty after the segmentation fault:

(gdb) run
Starting program: /home/msrd0/git/slurp/build/slurp 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
move_seat (seat=0x555555570440, surface_x=131094, surface_y=96053) at ../main.c:34
34              int x = wl_fixed_to_int(surface_x) + seat->current_output->logical_geometry.x;
(gdb) bt
#0  move_seat (seat=0x555555570440, surface_x=131094, surface_y=96053) at ../main.c:34
#1  0x0000555555559766 in touch_handle_motion (data=<error reading variable: Cannot access memory at address 0x7fffffffda58>, touch=<error reading variable: Cannot access memory at address 0x7fffffffda50>, 
    time=<error reading variable: Cannot access memory at address 0x7fffffffda4c>, id=<error reading variable: Cannot access memory at address 0x7fffffffda48>, x=<error reading variable: Cannot access memory at address 0x7fffffffda44>, 
    y=<error reading variable: Cannot access memory at address 0x7fffffffda40>) at ../main.c:308
Backtrace stopped: Cannot access memory at address 0x7fffffffda78
(gdb) q

If I can provide any other debugging help please let me know.

@emersion
Copy link
Owner

emersion commented Apr 7, 2020

Can you provide WAYLAND_DEBUG=1 logs?

@emersion emersion added the bug Something isn't working label Apr 7, 2020
@emersion
Copy link
Owner

emersion commented Apr 7, 2020

cc @gg-rewrite (just FYI)

@msrd0
Copy link
Author

msrd0 commented Apr 7, 2020

Can you provide WAYLAND_DEBUG=1 logs?

Sure:

$ WAYLAND_DEBUG=1 slurp
[1403252.557]  -> [email protected]_registry(new id wl_registry@2)
[1403252.594]  -> [email protected](new id wl_callback@3)
[1403252.756] [email protected]_id(3)
[1403252.774] [email protected](1, "wl_shm", 1)
[1403252.786]  -> [email protected](1, "wl_shm", 1, new id [unknown]@4)
[1403252.800] [email protected](2, "zwp_linux_dmabuf_v1", 3)
[1403252.816] [email protected](3, "wl_drm", 2)
[1403252.832] [email protected](4, "wl_compositor", 4)
[1403252.850]  -> [email protected](4, "wl_compositor", 4, new id [unknown]@5)
[1403252.877] [email protected](5, "wl_subcompositor", 1)
[1403252.892] [email protected](6, "wl_data_device_manager", 3)
[1403252.904] [email protected](7, "zwlr_gamma_control_manager_v1", 1)
[1403252.916] [email protected](8, "gtk_primary_selection_device_manager", 1)
[1403252.935] [email protected](9, "zxdg_output_manager_v1", 3)
[1403252.956]  -> [email protected](9, "zxdg_output_manager_v1", 1, new id [unknown]@6)
[1403252.994] [email protected](10, "org_kde_kwin_idle", 1)
[1403253.010] [email protected](11, "zwp_idle_inhibit_manager_v1", 1)
[1403253.025] [email protected](12, "zwlr_layer_shell_v1", 2)
[1403253.046]  -> [email protected](12, "zwlr_layer_shell_v1", 1, new id [unknown]@7)
[1403253.075] [email protected](13, "xdg_wm_base", 2)
[1403253.096] [email protected](14, "zwp_tablet_manager_v2", 1)
[1403253.117] [email protected](15, "org_kde_kwin_server_decoration_manager", 1)
[1403253.139] [email protected](16, "zxdg_decoration_manager_v1", 1)
[1403253.161] [email protected](17, "zwp_relative_pointer_manager_v1", 1)
[1403253.181] [email protected](18, "zwp_pointer_constraints_v1", 1)
[1403253.205] [email protected](19, "wp_presentation", 1)
[1403253.228] [email protected](20, "zwlr_output_manager_v1", 1)
[1403253.250] [email protected](21, "zwlr_export_dmabuf_manager_v1", 1)
[1403253.269] [email protected](22, "zwlr_screencopy_manager_v1", 2)
[1403253.292] [email protected](23, "zwlr_data_control_manager_v1", 2)
[1403253.314] [email protected](24, "zwp_primary_selection_device_manager_v1", 1)
[1403253.337] [email protected](25, "zwp_virtual_keyboard_manager_v1", 1)
[1403253.357] [email protected](26, "zwlr_virtual_pointer_manager_v1", 1)
[1403253.379] [email protected](27, "zwlr_input_inhibit_manager_v1", 1)
[1403253.400] [email protected](28, "wl_seat", 7)
[1403253.421]  -> [email protected](28, "wl_seat", 1, new id [unknown]@8)
[1403253.448] [email protected](29, "zwp_pointer_gestures_v1", 1)
[1403253.471] [email protected](30, "wl_output", 3)
[1403253.491]  -> [email protected](30, "wl_output", 3, new id [unknown]@9)
[1403253.520] [email protected](9876)
[1403253.533]  -> [email protected]_surface(new id wl_surface@3)
[1403253.547]  -> [email protected]_layer_surface(new id zwlr_layer_surface_v1@10, wl_surface@3, wl_output@9, 3, "selection")
[1403253.585]  -> [email protected]_xdg_output(new id zxdg_output_v1@11, wl_output@9)
[1403253.603]  -> [email protected]_anchor(15)
[1403253.614]  -> [email protected]_keyboard_interactivity(1)
[1403253.624]  -> [email protected]_exclusive_zone(-1)
[1403253.636]  -> [email protected]()
[1403253.666]  -> [email protected]_pool(new id wl_shm_pool@12, fd 5, 2304)
[1403253.861]  -> [email protected](6912)
[1403254.790]  -> [email protected](16128)
[1403254.822]  -> [email protected](34560)
[1403254.856]  -> [email protected](71424)
[1403254.917]  -> [email protected](145152)
[1403255.045]  -> [email protected](292608)
[1403256.149]  -> [email protected](587520)
[1403258.667]  -> [email protected](1177344)
[1403268.711]  -> [email protected](new id wl_callback@13)
[1403268.878] [email protected]_id(13)
[1403268.892] [email protected](7)
[1403268.897]  -> [email protected]_pointer(new id wl_pointer@14)
[1403268.904]  -> [email protected]_keyboard(new id wl_keyboard@15)
[1403268.909]  -> [email protected]_touch(new id wl_touch@16)
[1403268.915] [email protected](0, 0, 310, 170, 0, "Unknown", "0x0779", 0)
[1403268.938] [email protected](1, 1920, 1080, 60024)
[1403268.949] [email protected](1)
[1403268.954] [email protected]()
[1403268.958] [email protected]_position(0, 0)
[1403268.967] [email protected]_size(1920, 1080)
[1403268.979] [email protected]()
[1403268.984] [email protected]()
[1403268.988] [email protected](9877, 1920, 1080)
[1403269.001]  -> [email protected]_configure(9877)
[1403269.049]  -> [email protected]_pool(new id wl_shm_pool@17, fd 6, 8294400)
[1403269.072]  -> [email protected]_buffer(new id wl_buffer@18, 0, 1920, 1080, 7680, 0)
[1403269.102]  -> [email protected]()
[1403273.670]  -> [email protected](new id wl_callback@19)
[1403273.692]  -> [email protected](wl_buffer@18, 0, 0)
[1403273.700]  -> [email protected](0, 0, 1920, 1080)
[1403273.710]  -> [email protected]_buffer_scale(1)
[1403273.714]  -> [email protected]()
[1403273.718] [email protected](9877)
[1403273.724]  -> [email protected]_surface(new id wl_surface@13)
[1403277.449] [email protected]_id(17)
[1403277.470] [email protected](1, fd 5, 48373)
[1403278.967] [email protected]()
[1403278.983] [email protected](9879, wl_surface@3, 1569.257812, 712.921875)
[1403278.996]  -> [email protected]_buffer_scale(1)
[1403279.007]  -> [email protected]_buffer(new id wl_buffer@17, 347904, 24, 24, 96, 0)
[1403279.034]  -> [email protected](wl_buffer@17, 0, 0)
[1403279.053]  -> [email protected]_cursor(9879, wl_surface@13, 11, 11)
[1403279.079]  -> [email protected]()
[1403279.085] [email protected](9882, wl_surface@3, array)
[1403279.103] [email protected](9883, 0, 0, 0, 0)
[1403287.488] [email protected]_id(19)
[1403287.563] [email protected](767070418)
[1403362.603] [email protected](9884, 767070493, 28, 0)
[1404486.639] [email protected](9885, 767071617, wl_surface@3, 0, 546.269531, 353.359375)
[1404486.745] [email protected]()
[1404486.765] [email protected](9886, wl_surface@3)
[1404495.270] [email protected](767071626, 0, 552.074219, 356.574219)
Segmentation fault (core dumped)

@emersion
Copy link
Owner

emersion commented Apr 7, 2020

Ah, this is fixed in Sway master.

@msrd0
Copy link
Author

msrd0 commented Apr 7, 2020

Ok I can confirm it works with sway-git package. Sorry for bothering you.

@msrd0 msrd0 closed this as completed Apr 7, 2020
@emersion
Copy link
Owner

emersion commented Apr 8, 2020

Let's keep this open, we shouldn't segfault even if the compositor sends this sequence of events.

@emersion emersion reopened this Apr 8, 2020
@msrd0
Copy link
Author

msrd0 commented Apr 8, 2020

Yeah I agree, sorry for closing

@NilsIrl
Copy link
Contributor

NilsIrl commented Apr 9, 2020

@msrd0 You can run gdb inside of tmux (maybe screen as well) to get a backtrace.

@msrd0
Copy link
Author

msrd0 commented Apr 10, 2020

Good idea, here is the full backtrace through tmux:

Reading symbols from ./build/slurp...
(gdb) run
Starting program: /home/msrd0/git/slurp/build/slurp 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
move_seat (seat=0x555555570440, surface_x=30379, surface_y=58882) at ../main.c:34
34              int x = wl_fixed_to_int(surface_x) + seat->current_output->logical_geometry.x;
(gdb) bt full
#0  move_seat (seat=0x555555570440, surface_x=30379, surface_y=58882) at ../main.c:34
        x = 1431769344
        y = 0
#1  0x0000555555559766 in touch_handle_motion (data=0x555555570440, touch=0x555555571810, time=1020022958, id=0, x=30379, y=58882) at ../main.c:308
        seat = 0x555555570440
#2  0x00007ffff76f869a in ffi_call_unix64 () from /usr/lib/libffi.so.6
No symbol table info available.
#3  0x00007ffff76f7fb6 in ffi_call () from /usr/lib/libffi.so.6
No symbol table info available.
#4  0x00007ffff7e36e92 in ?? () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#5  0x00007ffff7e336c1 in ?? () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#6  0x00007ffff7e34ccc in wl_display_dispatch_queue_pending () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#7  0x000055555555ac5d in main (argc=1, argv=0x7fffffffdf38) at ../main.c:844
        state = {running = true, edit_anchor = false, display = 0x555555569d00, registry = 0x55555556e880, shm = 0x555555570c30, compositor = 0x555555570d10, layer_shell = 0x555555570e40, xdg_output_manager = 0x555555570da0, outputs = {prev = 0x555555570590, 
            next = 0x555555570590}, seats = {prev = 0x555555570458, next = 0x555555570458}, xkb_context = 0x55555556dea0, colors = {background = 4294967104, border = 255, selection = 0}, border_weight = 2, display_dimensions = false, single_point = false, boxes = {
            prev = 0x7fffffffde08, next = 0x7fffffffde08}, result = {x = 0, y = 0, width = 0, height = 0, link = {prev = 0x0, next = 0x0}}}
        opt = -1
        format = 0x55555555c1c5 "%x,%y %wx%h"
        cursor_theme = 0x0
        cursor_size_str = 0x7fffffffe5ce "24"
        cursor_size = 24
        output = 0x7fffffffddb8
        seat = 0x7fffffffddc0
        output_tmp = 0x30
        seat_tmp = 0x20
        box = 0x401
        box_tmp = 0x7ffff7ca82d5 <_int_memalign+341>
(gdb) q

@gg-rewrite
Copy link
Contributor

This was discussed in #50. While the current build will work with sway-git, the ideal behaviour should be handling touch and pointer events separately. I've created a PR #55 (whew, finally), please review it.

@msrd0
Copy link
Author

msrd0 commented Apr 12, 2020

Thanks @gg-rewrite, I just compiled your branch from #55 and it works as expected on sway stable on my ArchLinux laptop.

gg-rewrite added a commit to gg-rewrite/slurp that referenced this issue Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants