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

Sway crash caused by swww memory leak #8485

Open
baltitenger opened this issue Dec 3, 2024 · 1 comment
Open

Sway crash caused by swww memory leak #8485

baltitenger opened this issue Dec 3, 2024 · 1 comment
Labels
bug Not working as intended

Comments

@baltitenger
Copy link
Contributor

sway version: 1.10-dev-1d783794b
wlroots version: 0.19.0-dev-9aca98586

Stack Trace:
#0  0x00007a15b41d33af in wl_list_remove (elm=elm@entry=0x606ee2b7b740)
    at ../wayland-1.23.1/src/wayland-util.c:56
No locals.
#1  0x00007a15b40dff08 in shared_buffer_destroy (r=r@entry=0x606ee2503220, 
    buffer=buffer@entry=0x606ee2b7b740)
    at ../wlroots-git/render/vulkan/renderer.c:197
No locals.
#2  0x00007a15b40e018b in vulkan_get_stage_span (r=r@entry=0x606ee2503220, 
    size=size@entry=6220800, alignment=<optimized out>)
    at ../wlroots-git/render/vulkan/renderer.c:339
        buf = 0x606ee2b7b740
        bsize = 24883200
        res = <optimized out>
        buf_info = {sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, pNext = 0x0, 
          flags = 0, size = 24883200, usage = 3, 
          sharingMode = VK_SHARING_MODE_EXCLUSIVE, queueFamilyIndexCount = 0, 
          pQueueFamilyIndices = 0x0}
        mem_reqs = {size = 24883200, alignment = 64, memoryTypeBits = 7}
        mem_type_index = <optimized out>
        mem_info = {sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, 
          pNext = 0x0, allocationSize = 24883200, memoryTypeIndex = 1}
        a = <optimized out>
        __PRETTY_FUNCTION__ = "vulkan_get_stage_span"
#3  0x00007a15b40e6b91 in write_pixels (texture=texture@entry=0x606ee26b3690, 
    stride=5760, region=region@entry=0x606ee2e19608, vdata=0x7a154e3aec00, 
    old_layout=old_layout@entry=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 
    src_stage=src_stage@entry=128, src_access=32)
    at ../wlroots-git/render/vulkan/texture.c:74
        renderer = 0x606ee2503220
        format_info = 0x7a15b41978dc <pixel_format_info.lto_priv+220>
        bsize = <optimized out>
        rects_len = 1
        rects = <optimized out>
        copies = 0x606ee2ca49e0
        span = <optimized out>
        map = <optimized out>
        buf_off = <optimized out>
        cb = <optimized out>
        __PRETTY_FUNCTION__ = "write_pixels"
#4  0x00007a15b40e7074 in vulkan_texture_update_from_buffer (
    wlr_texture=0x606ee26b3690, buffer=0x606ee2fe84a0, damage=0x606ee2e19608)
    at ../wlroots-git/render/vulkan/texture.c:175
        texture = 0x606ee26b3690
        data = 0x7a154e3aec00
        format = 875710274
        stride = 5760
        ok = true
#5  0x00007a15b4127eae in surface_apply_damage (surface=0x606ee2e195f0)
    at ../wlroots-git/types/wlr_compositor.c:421
        buffer = <optimized out>
        buffer = <optimized out>
#6  surface_commit_state (surface=0x606ee2e195f0, next=0x606ee2e19770)
    at ../wlroots-git/types/wlr_compositor.c:536
        invalid_buffer = <optimized out>
        subsurface = <optimized out>
        __PRETTY_FUNCTION__ = "surface_commit_state"
#7  0x00007a15b37dd596 in ffi_call_unix64 () at ../src/x86/unix64.S:104
No locals.
#8  0x00007a15b37da00e in ffi_call_int (cif=cif@entry=0x7ffca24a4170, 
    fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, 
    closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
        classes = {X86_64_INTEGER_CLASS, 32764, 3011348300, 31253}
        stack = <optimized out>
        argp = 0x7ffca24a3fc0 ""
        arg_types = <optimized out>
        gprcount = 2
        ssecount = <optimized out>
        ngpr = 1
        nsse = 0
        i = <optimized out>
        avn = <optimized out>
        flags = <optimized out>
        reg_args = <optimized out>
#9  0x00007a15b37dcbd3 in ffi_call (cif=cif@entry=0x7ffca24a4170, 
    fn=<optimized out>, rvalue=rvalue@entry=0x0, 
    avalue=avalue@entry=0x7ffca24a4240) at ../src/x86/ffi64.c:710
        arg_types = 0x7ffca24a4190
        i = <optimized out>
        nargs = 2
        max_reg_struct_size = <optimized out>
#10 0x00007a15b41d1e85 in wl_closure_invoke (
    closure=closure@entry=0x606ee2fea6e0, target=<optimized out>, 
    target@entry=0x606ee2e199c0, opcode=opcode@entry=6, data=<optimized out>, 
    data@entry=0x606ee26b8640, flags=2)
    at ../wayland-1.23.1/src/connection.c:1228
        count = 0
        cif = {abi = FFI_UNIX64, nargs = 2, arg_types = 0x7ffca24a4190, 
          rtype = 0x7a15b37de1a0 <ffi_type_void>, bytes = 0, flags = 0}
        ffi_types = {0x7a15b37de2a0 <ffi_type_pointer>, 
          0x7a15b37de2a0 <ffi_type_pointer>, 0x7a15b37de240 <ffi_type_uint32>, 
          0x7a15b37de330 <ffi_type_sint32>, 0x7a15b37de330 <ffi_type_sint32>, 
          0x7a15b37de330 <ffi_type_sint32>, 0x290, 0x606ee3007f40, 
          0x7ffca24a4210, 0x7a15b3ed597a <_int_free_merge_chunk+170>, 
          0x7ffca24a4220, 0x7a15b401aac0 <main_arena>, 0x0, 
          0x7a15b401aac0 <main_arena>, 0x290, 0x606ee300ee90, 0x7ffca24a4250, 
          0x7a15b3ed45fc <_int_free_create_chunk+156>, 0x7ffca24a4280, 
          0x7a15b3ed725a <_int_malloc+2938>, 0x721, 0xc}
        ffi_args = {0x7ffca24a4150, 0x7ffca24a4158, 0xf0, 0xd8, 
          0x7a15b401aac0 <main_arena>, 0x16e90, 0x606ee3018170, 0x0, 
          0x7ffca24a42d0, 0x7a15b41d39d8 <log_closure+88>, 0x606ee2fea6e0, 
          0x7ffca24a43d0, 0x7ffca24a42f0, 0x606ee24c1720, 0x8, 
          0x7a15b41dd430 <wl_surface_requests+144>, 0x0, 0x0, 0x7ffca24a4330, 
          0x7a15b41d0f05 <wl_closure_init+101>, 0xd80000000b, 0xd8}
        implementation = <optimized out>
#11 0x00007a15b41d6d22 in wl_client_connection_data (fd=<optimized out>, 
    mask=<optimized out>, data=0x606ee26b8640)
    at ../wayland-1.23.1/src/wayland-server.c:444
        client = 0x606ee26b8640
        connection = 0x606ee26b8730
        resource = <optimized out>
        object = 0x606ee2e199c0
        closure = 0x606ee2fea6e0
        message = 0x7a15b41dd430 <wl_surface_requests+144>
        p = {17, 524294}
        resource_flags = 0
        opcode = 6
        size = <optimized out>
        since = <optimized out>
        len = <optimized out>
#12 0x00007a15b41d5112 in wl_event_loop_dispatch (loop=0x606ee24c1810, 
    timeout=<optimized out>, timeout@entry=-1)
    at ../wayland-1.23.1/src/event-loop.c:1105
        ep = {{events = 1, data = {ptr = 0x606ee2ca2d50, fd = -490066608, 
              u32 = 3804900688, u64 = 106029367569744}}, {events = 4, data = {
              ptr = 0x606ee3018130, fd = -486440656, u32 = 3808526640, 
              u64 = 106029371195696}}, {events = 3798697776, data = {
              ptr = 0x80000606e, fd = 24686, u32 = 24686, u64 = 34359763054}}, 
          {events = 0, data = {ptr = 0x7ffca24a45e0, fd = -1572190752, 
              u32 = 2722776544, u64 = 140723031262688}}, {events = 3798697872, 
            data = {ptr = 0xffffffff0000606e, fd = 24686, u32 = 24686, 
              u64 = 18446744069414609006}}, {events = 4294967295, data = {
              ptr = 0x7ffca24a4700, fd = -1572190464, u32 = 2722776832, 
              u64 = 140723031262976}}, {events = 3021805275, data = {
              ptr = 0x606e00007a15, fd = 31253, u32 = 31253, 
              u64 = 106025562700309}}, {events = 4, data = {ptr = 0x8164, 
              fd = 33124, u32 = 33124, u64 = 33124}}, {events = 2722776640, 
            data = {ptr = 0x800007ffc, fd = 32764, u32 = 32764, 
              u64 = 34359771132}}, {events = 0, data = {ptr = 0x0, fd = 0, 
              u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, fd = 0, 
              u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, fd = 0, 
              u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, fd = 0, 
              u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, fd = 0, 
              u32 = 0, u64 = 0}}, {events = 3468268238, data = {
              ptr = 0xe2e83a240000606e, fd = 24686, u32 = 24686, 
              u64 = 16350382373461844078}}, {events = 24686, data = {
              ptr = 0x8, fd = 8, u32 = 8, u64 = 8}}, {events = 3806869696, 
            data = {ptr = 0x40000606e, fd = 24686, u32 = 24686, 
              u64 = 17179893870}}, {events = 0, data = {ptr = 0x14, fd = 20, 
              u32 = 20, u64 = 20}}, {events = 1, data = {ptr = 0x5400000001, 
              fd = 1, u32 = 1, u64 = 360777252865}}, {events = 24686, data = {
              ptr = 0x606ee2a26068, fd = -492674968, u32 = 3802292328, 
              u64 = 106029364961384}}, {events = 3802292304, data = {
              ptr = 0xe2a260480000606e, fd = 24686, u32 = 24686, 
              u64 = 16330721061152776302}}, {events = 24686, data = {
              ptr = 0x3000000010, fd = 16, u32 = 16, u64 = 206158430224}}, {
            events = 2722776928, data = {ptr = 0xa24a469000007ffc, fd = 32764, 
              u32 = 32764, u64 = 11694236966710181884}}, {events = 32764, 
            data = {ptr = 0x194568bb52c0d700, fd = 1388369664, 
              u32 = 1388369664, u64 = 1820976778097776384}}, {
            events = 3021799824, data = {ptr = 0xe29c047000007a15, fd = 31253, 
              u32 = 31253, u64 = 16328931228021455381}}, {events = 24686, 
            data = {ptr = 0x606ecebf2410, fd = -826334192, u32 = 3468633104, 
              u64 = 106029031302160}}, {events = 506, data = {
              ptr = 0xe24eb39000000000, fd = 0, u32 = 0, 
              u64 = 16307168731811807232}}, {events = 24686, data = {
              ptr = 0x7, fd = 7, u32 = 7, u64 = 7}}, {events = 3802274512, 
            data = {ptr = 0x52c0d7000000606e, fd = 24686, u32 = 24686, 
              u64 = 5963002301638533230}}, {events = 423979195, data = {
              ptr = 0x300000002, fd = 2, u32 = 2, u64 = 12884901890}}, {
            events = 3808151616, data = {ptr = 0xe24c17480000606e, fd = 24686, 
              u32 = 24686, u64 = 16306433948806832238}}, {events = 24686, 
            data = {ptr = 0x606ee24c1768, fd = -498329752, u32 = 3796637544, 
              u64 = 106029359306600}}}
        source = <optimized out>
        i = 0
        count = <optimized out>
        has_timers = <optimized out>
        use_timeout = false
        now = {tv_sec = 106029367567152, tv_nsec = -552}
        end = <optimized out>
#13 0x00007a15b41d71f7 in wl_display_run (display=0x606ee24c1720)
    at ../wayland-1.23.1/src/wayland-server.c:1530
No locals.
#14 0x0000606eceb93dd2 in server_run (server=<optimized out>)
    at ../sway-git/sway/server.c:508
No locals.
#15 main (argc=<optimized out>, argv=<optimized out>)
    at ../sway-git/sway/main.c:374
        config_path = 0x0
        c = <optimized out>
        validate = false
        debug = false
        verbose = false

Description:

I have a script that periodically tells swww to change my wallpaper. I also have swayidle configured to turn off my monitors after a while. If I leave it running, eventually sway crashes after logging this:

[ERROR] [wlr] [render/vulkan/renderer.c:304] vkAllocatorMemory: ERROR_OUT_OF_DEVICE_MEMORY (-2)

While leaking memory is obviously swww's fault, if possible, it shouldn't lead to a sway crash.

Relevant swww issue: LGFae/swww#382

@baltitenger baltitenger added the bug Not working as intended label Dec 3, 2024
@emersion
Copy link
Member

emersion commented Dec 6, 2024

nschloe pushed a commit to live-clones/wlroots that referenced this issue Dec 6, 2024
nschloe pushed a commit to live-clones/wlroots that referenced this issue Dec 11, 2024
Closes: swaywm/sway#8485
(cherry picked from commit 9649fbe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants