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

segfault when powering other monitor off #3047

Closed
Kommynct opened this issue Mar 20, 2024 · 7 comments · Fixed by #3136
Closed

segfault when powering other monitor off #3047

Kommynct opened this issue Mar 20, 2024 · 7 comments · Fixed by #3136
Labels
bug Something isn't working clock inhibitor

Comments

@Kommynct
Copy link

Kommynct commented Mar 20, 2024

*** impl_ext_end_proxy called from wrong context, check thread and locking: Operation not permitted

I'm getting this error most of the time when I turn my screen off, and waybar crashes

https://gitlab.com/that1communist/dotfiles/-/blob/master/.config/waybar/config

these are my dotfiles if it helps

@github-actions github-actions bot added bug Something isn't working clock inhibitor labels Mar 20, 2024
@hrdl-github
Copy link
Contributor

I believe I saw the same, even though the backtrace points at pipewire:

Core was generated by `waybar -b bar-0'.
Program terminated with signal SIGABRT, Aborted.
[Current thread is 1 (Thread 0x718357e006c0 (LWP 132475))]
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007183efaab393 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007183efa5a6c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007183efa424b8 in __GI_abort () at abort.c:79
#4  0x00007183efa43395 in __libc_message_impl (fmt=fmt@entry=0x7183efbbb2ea "%s\n") at ../sysdeps/posix/libc_fatal.c:132
#5  0x00007183efab52a7 in malloc_printerr (str=str@entry=0x7183efbbe570 "free(): double free detected in tcache 2") at malloc.c:5772
#6  0x00007183efab7799 in _int_free (av=0x7183efbf6ac0 <main_arena>, p=<optimized out>, have_lock=have_lock@entry=0) at malloc.c:4541
#7  0x00007183efab9e93 in __GI___libc_free (mem=<optimized out>) at malloc.c:3398
#8  0x00007183eb98370a in free_source (s=<optimized out>) at ../pipewire/spa/plugins/support/loop.c:384
#9  process_destroy (impl=0x63e16e0c8358) at ../pipewire/spa/plugins/support/loop.c:392
#10 loop_iterate (object=0x63e16e0c8358, timeout=<optimized out>) at ../pipewire/spa/plugins/support/loop.c:491
#11 0x00007183f0aba09d in do_loop (user_data=0x63e16df8da80) at ../pipewire/src/pipewire/thread-loop.c:295
#12 0x00007183efaa955a in start_thread (arg=<optimized out>) at pthread_create.c:447
#13 0x00007183efb26a3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

I've also a relevant portion of my systemd journal.
system.log

@asahi-m
Copy link

asahi-m commented Apr 1, 2024

I have the same issue. It seems that happens when the privacy module is used.

@hrdl-github
Copy link
Contributor

I have filed an issue with the pipewire project: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3948

@hrdl-github
Copy link
Contributor

Waybar's pipewire backend https://github.com/Alexays/Waybar/blob/42dc9cb85f27e3db02da83cd13624cfc5a7191d3/src/util/pipewire/pipewire_backend.cpp does not use the locking scheme described in https://docs.pipewire.org/page_thread_loop.html, but only an internal mutex in handleRegistryEventGlobalRemove. Do you have any thoughts on this, @ErikReider ?

@hrdl-github
Copy link
Contributor

I just got another stack trace when suspending. It's again related to pipewire and could be explained by lack of locking:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000077ea2af068b9 in on_remote_data (data=0x5c1c46a21fb0, fd=47, mask=<optimized out>) at ../pipewire/src/modules/module-protocol-native.c:1093
Downloading source file /usr/src/debug/pipewire/build/../pipewire/src/modules/module-protocol-native.c
1093				pw_loop_update_io(loop, impl->source,
[Current thread is 1 (Thread 0x77ea00c006c0 (LWP 465914))]
(gdb) bt full
#0  0x000077ea2af068b9 in on_remote_data (data=0x5c1c46a21fb0, fd=47, mask=<optimized out>) at ../pipewire/src/modules/module-protocol-native.c:1093
        _f = 0x77ea2af9f620 <impl_loop_utils>
        _res = -95
        _o = 0x5c1c46a2e7a0
        impl = 0x5c1c46a21fb0
        this = 0x5c1c46a20eb0
        core_proxy = 0x5c1c46a20eb0
        conn = 0x5c1c46a22070
        context = <optimized out>
        loop = 0x5c1c46a457e0
        res = 0
        __func__ = "on_remote_data"
#1  0x000077ea2af88646 in loop_iterate (object=0x5c1c46a2e748, timeout=<optimized out>) at ../pipewire/spa/plugins/support/loop.c:496
        s = <optimized out>
        impl = 0x5c1c46a2e748
        ep = {{events = 4, data = 0x0}, {events = 0, data = 0x0}, {events = 909377536, data = 0x7c7fee9b5852bd00}, {events = 0, data = 0x77ea00bffa30}, {events = 4198400, data = 0x77ea00bffbd0}, {events = 0, data = 0x7ffc75c06350}, {events = 4194304, data = 0x77ea2f09df0e <__vsnprintf_internal+126>}, {events = 12581840, data = 0x77ea00bffbed}, {events = 12581875, data = 0x0}, {events = 2, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x7c7fee9b5852bd00}, {events = 8388608, data = 0x77ea2f0782f6 <__GI___snprintf+150>}, {events = 32, data = 0x77ea00bffbd0}, {events = 12581648, data = 0x7c7fee9b5852bd00}, {events = 0, data = 0x0}, {events = 0, data = 0x71bfa}, {events = 12584640, data = 0x7ffc75c06447}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x7c7fee9b5852bd00}, {events = 8388608, data = 0x77ea00401000}}
        e = <optimized out>
        i = 0
        nfds = 1
#2  0x000077ea2f7a709d in do_loop (user_data=0x5c1c46a456d0) at ../pipewire/src/pipewire/thread-loop.c:295
        _f = <optimized out>
        _res = <optimized out>
        _o = <optimized out>
        this = 0x5c1c46a456d0
        res = <optimized out>
        __func__ = "do_loop"
#3  0x000077ea2f0a955a in start_thread (arg=<optimized out>) at pthread_create.c:447
        ret = <optimized out>
        pd = <optimized out>
        out = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {131846918637248, -6178555318219675998, -216, 0, 140722284028752, 131846910246912, 5014016923385095842, 5013916755034400418}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#4  0x000077ea2f126a3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

@hrdl-github
Copy link
Contributor

And another one, finally connecting the destruction of an output as outlined in the original issue description to pipewire:

Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
44	      return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
[Current thread is 1 (Thread 0x7d6f76a006c0 (LWP 736149))]
(gdb) bt full
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
        tid = <optimized out>
        ret = 0
        pd = <optimized out>
        old_mask = {__val = {137917685037216}}
        ret = <optimized out>
#1  0x00007d6fa98ab393 in __pthread_kill_internal (signo=6, threadid=<optimized out>)
    at pthread_kill.c:78
#2  0x00007d6fa985a6c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = <optimized out>
#3  0x00007d6fa98424b8 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {4611686293305294896, 104084872377792, 137918470545819, 104084871616344, 104084872377824, 104084872712832, 104084871616424, 104084871616448, 104084871616480, 0, 137918539796066, 137917685037008, 18446744073709551615, 137917685037040, 137918539787898, 1073741888}}, sa_flags = -1519260844, sa_restorer = 0x7d6f769ff7f0}
#4  0x00007d6fa9843395 in __libc_message_impl (fmt=fmt@entry=0x7d6fa99bb2ea "%s\n")
    at ../sysdeps/posix/libc_fatal.c:132
        ap = {{gp_offset = 16, fp_offset = 0, overflow_arg_area = 0x7d6f769ff920, reg_save_area = 0x7d6f769ff8b0}}
        fd = 2
        iov = {{iov_base = 0x7d6fa99be570, iov_len = 40}, {iov_base = 0x7d6fa99bb2ec, iov_len = 1}, {iov_base = 0x7d6f769ff830, iov_len = 96}, {iov_base = 0x7d6f769ff840, iov_len = 14662012186574771968}, {iov_base = 0x0, iov_len = 104084872712840}, {iov_base = 0x5eaa25dd40c0, iov_len = 104084872713152}, {iov_base = 0x5eaa25d835c0, iov_len = 104084872712640}}
        iovcnt = <optimized out>
        total = <optimized out>
        cp = <optimized out>
#5  0x00007d6fa98b52a7 in malloc_printerr
    (str=str@entry=0x7d6fa99be570 "free(): double free detected in tcache 2") at malloc.c:5772
#6  0x00007d6fa98b7799 in _int_free
    (av=0x7d6fa99f6ac0 <main_arena>, p=<optimized out>, have_lock=have_lock@entry=0) at malloc.c:4541
        tmp = <optimized out>
        cnt = <optimized out>
        e = <optimized out>
        tc_idx = <optimized out>
        size = <optimized out>
        fb = <optimized out>
#7  0x00007d6fa98b9e93 in __GI___libc_free (mem=<optimized out>) at malloc.c:3398
        ar_ptr = <optimized out>
        p = <optimized out>
        err = 9
#8  0x00007d6fa578870a in free_source (s=<optimized out>) at ../pipewire/spa/plugins/support/loop.c:384
#9  process_destroy (impl=0x5eaa25d2c2f8) at ../pipewire/spa/plugins/support/loop.c:392
        source = <optimized out>
        tmp = 0x5eaa25d2c358
        source = <optimized out>
        tmp = <optimized out>
#10 loop_iterate (object=0x5eaa25d2c2f8, timeout=<optimized out>)
    at ../pipewire/spa/plugins/support/loop.c:491
        impl = 0x5eaa25d2c2f8
        ep = {{events = 1, data = 0x0}, {events = 0, data = 0x0}, {events = 859242496, data = 0xcb79ee66a93cd700}, {events = 0, data = 0x7d6f769ffa30}, {events = 1981812736, data = 0x7d6f769ffbd0}, {events = 0, data = 0x7ffcd2b82550}, {events = 1981808640, data = 0x7d6fa989df0e <__vsnprintf_internal+126>}, {events = 1990196176, data = 0x7d6f769ffbed}, {events = 1990196211, data = 0x0}, {events = 2, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0xcb79ee66a93cd700}, {events = 8388608, data = 0x7d6fa98782f6 <__GI___snprintf+150>}, {events = 32, data = 0x7d6f769ffbd0}, {events = 1990195984, data = 0xcb79ee66a93cd700}, {events = 0, data = 0x0}, {events = 0, data = 0xb3b95}, {events = 1990198976, data = 0x7ffcd2b82647}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0x0}, {events = 0, data = 0xcb79ee66a93cd700}, {events = 8388608, data = 0x7d6f76201000}}
        e = <optimized out>
        i = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        nfds = 1
#11 0x00007d6faa84809d in do_loop (user_data=0x5eaa25daa710)
    at ../pipewire/src/pipewire/thread-loop.c:295
        _f = <optimized out>
        _res = <optimized out>
        _o = <optimized out>
        this = 0x5eaa25daa710
        res = <optimized out>
        __func__ = "do_loop"
#12 0x00007d6fa98a955a in start_thread (arg=<optimized out>) at pthread_create.c:447
        ret = <optimized out>
        pd = <optimized out>
        out = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {137917685040832, 230234032324924763, -216, 0, 140723843769680, 137917676650496, -437102472038787749, -437227718871820965}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#13 0x00007d6fa9926a3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

I'll try to hack together a solution using pipewire's recommended locking scheme soon.

@ErikReider
Copy link
Contributor

Waybar's pipewire backend 42dc9cb/src/util/pipewire/pipewire_backend.cpp does not use the locking scheme described in docs.pipewire.org/page_thread_loop.html, but only an internal mutex in handleRegistryEventGlobalRemove. Do you have any thoughts on this, @ErikReider ?

Sorry for the late reply, thanks for fixing this oversight! :)

rncbc added a commit to rncbc/qpwgraph that referenced this issue May 4, 2024
  Problem: impl_ext_end_proxy called from wrong context, check thread and locking.

  Similar info: Alexays/Waybar#3047
  Locking info: https://docs.pipewire.org/page_thread_loop.html
  Possibly working solution below adapted from:
    Alexays/Waybar@7477388

  Signed-off-by: Peder Hedlund <peder.hedlund@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clock inhibitor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants