jD91mZM2 / xidlehook

GitLab: https://gitlab.com/jD91mZM2/xidlehook
MIT License
382 stars 33 forks source link

xidlehook's pulse module segfaulted #56

Open huyhoang8398 opened 3 years ago

huyhoang8398 commented 3 years ago

an 15 05:14:38 kn systemd-coredump[677499]: Process 238040 (xidlehook) of user 1000 dumped core.

                                         Stack trace of thread 238040:
                                         #0  0x0000560f26492163 n/a (xidlehook + 0xf9163)
                                         #1  0x0000560f264902e3 n/a (xidlehook + 0xf72e3)
                                         #2  0x0000560f263e9b30 n/a (xidlehook + 0x50b30)
                                         #3  0x0000560f263f9e5f n/a (xidlehook + 0x60e5f)
                                         #4  0x0000560f263ed3ec n/a (xidlehook + 0x543ec)
                                         #5  0x0000560f263ee35b n/a (xidlehook + 0x5535b)
                                         #6  0x0000560f263e05da n/a (xidlehook + 0x475da)
                                         #7  0x0000560f26400134 n/a (xidlehook + 0x67134)
                                         #8  0x0000560f263fd171 n/a (xidlehook + 0x64171)
                                         #9  0x0000560f263f6c3e n/a (xidlehook + 0x5dc3e)
                                         #10 0x0000560f263e28d0 n/a (xidlehook + 0x498d0)
                                         #11 0x0000560f263fa073 n/a (xidlehook + 0x61073)
                                         #12 0x0000560f263fa08d n/a (xidlehook + 0x6108d)
                                         #13 0x0000560f2651d577 n/a (xidlehook + 0x184577)
                                         #14 0x0000560f263e29e2 main (xidlehook + 0x499e2)
                                         #15 0x00007fbafe9b3152 __libc_start_main (libc.so.6 + 0x28152)
                                         #16 0x0000560f263d508e n/a (xidlehook + 0x3c08e)

                                         Stack trace of thread 238044:
                                         #0  0x00007fbafea8046f __poll (libc.so.6 + 0xf546f)
                                         #1  0x00007fbafebd6654 n/a (libpulse.so.0 + 0x33654)
                                         #2  0x00007fbafebbf9a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
                                         #3  0x00007fbafebca281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
                                         #4  0x00007fbafebca331 pa_mainloop_run (libpulse.so.0 + 0x27331)
                                         #5  0x00007fbafebda7fe n/a (libpulse.so.0 + 0x377fe)
                                         #6  0x00007fbafe94f5fc n/a (libpulsecommon-14.1.so + 0x565fc)
                                         #7  0x00007fbafeb5d3e9 start_thread (libpthread.so.0 + 0x93e9)
                                         #8  0x00007fbafea8b293 __clone (libc.so.6 + 0x100293)
jD91mZM2 commented 3 years ago

Not much to go on, but I suppose some of the unsafe code in the pulse module is doing this.

huyhoang8398 commented 3 years ago

yes I think so too, sometime pulse breaks xidlehook even i added --no audio param, should we create an issue for pulseaudio?

jD91mZM2 commented 3 years ago

No, it's probably not pulseaudio's fault - It's likely my usage of it is wrong. You should not be seeing it if you don't add --not-when-audio

jD91mZM2 commented 3 years ago

Hi! How does latest master (e26137e750f535f4e5fe048bac58c71178c4206c) work for you? I was able to reproduce the issue and I think I fixed it

LordChaos73 commented 3 years ago

I've build the latest master and testing it as we speak:

17882 /home/ericd/bin/xidlehook --not-when-fullscreen --not-when-audio --timer 180 ~/.config/i3/scripts/blur-lock.sh 0

LordChaos73 commented 3 years ago

Seems to work fine on my side; will you release a new version so we can notify the AUR packager?

huyhoang8398 commented 3 years ago

I've build the latest version and test it, it works fine for me

LordChaos73 commented 3 years ago

Unfortunately, this version also dumps core, but strangely enough there's little info:

           PID: 1493 (xidlehook)
           UID: 1000 (ericd)
           GID: 1000 (ericd)
        Signal: 11 (SEGV)
     Timestamp: Thu 2021-02-25 21:12:55 CET (13h ago)
  Command Line: /home/ericd/bin/xidlehook --not-when-fullscreen --not-when-audio --timer 180 ~/.config/i3/scripts/blur-lock.sh 0
    Executable: /home/ericd/bin/xidlehook
 Control Group: /user.slice/user-1000.slice/session-2.scope
          Unit: session-2.scope
         Slice: user-1000.slice
       Session: 2
     Owner UID: 1000 (ericd)
       Boot ID: 7eaccc8d05a44a049343e1f1b56985e4
    Machine ID: 3f719ca7a76a4602945e1e66b3d6097f
      Hostname: x1carbon6
       Storage: /var/lib/systemd/coredump/core.xidlehook.1000.7eaccc8d05a44a049343e1f1b56985e4.1493.1614283975000000.zst
       Message: Process 1493 (xidlehook) of user 1000 dumped core.

                Stack trace of thread 1493:
                #0  0x000055ca72696163 n/a (/home/ericd/bin/xidlehook + 0xf5163)

feb 25 21:12:56 x1carbon6 systemd-coredump[116712]: Process 1493 (xidlehook) of user 1000 dumped core.

                                                    Stack trace of thread 1493:
                                                    #0  0x000055ca72696163 n/a (/home/ericd/bin/xidlehook + 0xf5163)
feb 25 21:12:56 x1carbon6 systemd[1]: systemd-coredump@0-116711-0.service: Succeeded.
jD91mZM2 commented 3 years ago

Seems to work fine on my side; will you release a new version so we can notify the AUR packager?

Unfortunately, this version also dumps core, but strangely enough there's little info:

These messages seem to contradict each other @LordChaos73. What is the status of the git version, is it working and ready to be released or not?

The lack of stack trace could be because you ran strip on the binary. Are you installing it through AUR or something? That could result in stripped binaries.

LordChaos73 commented 3 years ago

I just cloned the repo from github and built the binary with cargo --build release.

Fri 2021-02-26 14:07:23 CET   93407  1000  1000  11 present   /home/ericd/bin/xidlehook
Fri 2021-02-26 14:16:35 CET   95312  1000  1000  11 present   /home/ericd/bin/xidlehook
LordChaos73 commented 3 years ago

I noticed the master branch was updated, I've rebuild the binary and I'm testing it again.

jD91mZM2 commented 3 years ago

Try building without --release, that should give you more info

LordChaos73 commented 3 years ago

I've done that and I'm testing the new binary as we speak. Will keep you updated.

LordChaos73 commented 3 years ago
 ericd@x1carbon6  ~  coredumpctl
TIME                            PID   UID   GID SIG COREFILE  EXE
Mon 2021-03-01 14:55:34 CET   24934  1000  1000  11 present   /home/ericd/bin/xidlehook
Mon 2021-03-01 15:12:36 CET   45593  1000  1000  11 present   /home/ericd/bin/xidlehook
Mon 2021-03-01 15:29:37 CET   51954  1000  1000  11 present   /home/ericd/bin/xidlehook
Mon 2021-03-01 16:04:06 CET   68818  1000  1000  11 present   /home/ericd/bin/xidlehook
 ericd@x1carbon6  ~  coredumpctl info 68818
           PID: 68818 (xidlehook)
           UID: 1000 (ericd)
           GID: 1000 (ericd)
        Signal: 11 (SEGV)
     Timestamp: Mon 2021-03-01 16:04:06 CET (11min ago)
  Command Line: /home/ericd/bin/xidlehook --not-when-fullscreen --not-when-audio --timer 180 ~/.config/i3/scripts/blur-lock.sh 0
    Executable: /home/ericd/bin/xidlehook
 Control Group: /user.slice/user-1000.slice/session-17.scope
          Unit: session-17.scope
         Slice: user-1000.slice
       Session: 17
     Owner UID: 1000 (ericd)
       Boot ID: bfa68a72ab6e40609f3dff947297b0dc
    Machine ID: 3f719ca7a76a4602945e1e66b3d6097f
      Hostname: x1carbon6
       Storage: /var/lib/systemd/coredump/core.xidlehook.1000.bfa68a72ab6e40609f3dff947297b0dc.68818.1614611046000000.zst
       Message: Process 68818 (xidlehook) of user 1000 dumped core.

                Stack trace of thread 68818:
                #0  0x000055f7dd38fc18 n/a (/home/ericd/bin/xidlehook + 0x2fcc18)
 ericd@x1carbon6  ~  ls -alh ~/bin/xidlehook
-rwxr-xr-x 1 ericd ericd 46M  1 mrt 13:49 /home/ericd/bin/xidlehook
 ericd@x1carbon6  ~  sha256sum ~/bin/xidlehook
b73a47c0480088e04c7f68bbdfad244d4e7a253573ea89e95fbce0dd2a53bb57  /home/ericd/bin/xidlehook
jD91mZM2 commented 3 years ago

Did you build without --release? Very strange that it wouldn't give you any additional information :/

LordChaos73 commented 3 years ago

Yes, I build it with cargo build. The binary grew from 12M to 46M. I killed the process and restarted it again.

jD91mZM2 commented 3 years ago

I don't know... Not sure how to gather more information here. Do you have pulseaudio up and running?

LordChaos73 commented 3 years ago

Yes, pulseaudio is up-and-running on my system:

libcanberra-pulse 0.30+2+gc0620e4-3
libpulse 14.2-2
pulseaudio 14.2-2
pulseaudio-bluetooth 14.2-2
LordChaos73 commented 3 years ago

I did some more testing, when playing audio (spotify) the screen is locked regardless, so it seems xidlehook it isn't detecting it. I haven't had a coredump for a while now. I'm running the binary from the master, not the AUR one. I do see issues regarding pulseaudio & the kernel popping up, so this might be related to the 5.11 kernel I'm running. Maybe I should try the LTS kernel as well.

LordChaos73 commented 3 years ago

Disregard my previous post; the screen got locked because my monitor went to sleep, which killed the HDMI audio. So detecting sound seems to work fine. I haven't had a coredump in the past 20 hours, so it is all good so far.

jD91mZM2 commented 3 years ago

Are you running xidlehook normally or via systemd? I've had users have issues with systemd in the past

LordChaos73 commented 3 years ago

xidlehook is started by i3:

exec --no-startup-id ~/.config/i3/scripts/xidlehook.sh

#!/usr/bin/env bash

HOME=/home/ericd

# start xidlehook only if it's not running yet
if [[ $(pgrep -i xidlehook) ]]; then
    # xidlehook is already running; just exit
    exit 0
else
    # start xidlehook
    $HOME/bin/xidlehook --not-when-fullscreen --not-when-audio --timer 180 '~/.config/i3/scripts/blur-lock.sh' 0
fi
LordChaos73 commented 3 years ago

The current version of master is already much more stable compared to the version in the AUR, I haven't had a coredump in a while. So to me it makes sense to push a new release.

jD91mZM2 commented 3 years ago

released :)

huyhoang8398 commented 3 years ago

great work! waiting for AUR update

LordChaos73 commented 3 years ago

Unfortunately I still get quite a few coredumps, especially when using the 5.11 kernel. When I was using the 5.10 LTS kernel, I almost had no coredumps from xidlehook. Unfortunately, I have no clue how I can debug this further.

ericd@x1carbon6  ~  coredumpctl
TIME                            PID   UID   GID SIG COREFILE  EXE
Sun 2021-03-14 11:58:53 CET    1641  1000  1000  11 missing   /usr/bin/xidlehook
Sun 2021-03-14 12:23:53 CET   13261  1000  1000  11 present   /usr/bin/xidlehook
Sun 2021-03-14 19:56:38 CET    1513  1000  1000  11 present   /usr/bin/xidlehook
Sun 2021-03-14 23:54:13 CET  158603  1000  1000  11 present   /usr/bin/xidlehook
Mon 2021-03-15 00:17:41 CET  171653  1000  1000  11 present   /usr/bin/xidlehook
Mon 2021-03-15 00:48:57 CET  174188  1000  1000  11 present   /usr/bin/xidlehook
Tue 2021-03-16 12:19:25 CET    1620  1000  1000  11 present   /usr/bin/xidlehook
Tue 2021-03-16 23:35:28 CET    1613  1000  1000  11 present   /usr/bin/xidlehook
 ericd@x1carbon6  ~  coredumpctl info 1613
           PID: 1613 (xidlehook)
           UID: 1000 (ericd)
           GID: 1000 (ericd)
        Signal: 11 (SEGV)
     Timestamp: Tue 2021-03-16 23:35:28 CET (14h ago)
  Command Line: xidlehook --not-when-fullscreen --not-when-audio --timer 180 ~/.config/i3/scripts/blur-lock.sh 0
    Executable: /usr/bin/xidlehook
 Control Group: /user.slice/user-1000.slice/session-2.scope
          Unit: session-2.scope
         Slice: user-1000.slice
       Session: 2
     Owner UID: 1000 (ericd)
       Boot ID: aaf726b1aeb24d20a4f7688fa0dcd22a
    Machine ID: 3f719ca7a76a4602945e1e66b3d6097f
      Hostname: x1carbon6
       Storage: /var/lib/systemd/coredump/core.xidlehook.1000.aaf726b1aeb24d20a4f7688fa0dcd22a.1613.1615934128000000.zst
       Message: Process 1613 (xidlehook) of user 1000 dumped core.

                Stack trace of thread 1613:
                #0  0x000055a2eb718783 n/a (xidlehook + 0xf5783)
                #1  0x000055a2eb716a67 n/a (xidlehook + 0xf3a67)
                #2  0x000055a2eb67cb40 n/a (xidlehook + 0x59b40)
                #3  0x000055a2eb68aa4f n/a (xidlehook + 0x67a4f)
                #4  0x000055a2eb67b796 n/a (xidlehook + 0x58796)
                #5  0x000055a2eb67f35b n/a (xidlehook + 0x5c35b)
                #6  0x000055a2eb6711fa n/a (xidlehook + 0x4e1fa)
                #7  0x000055a2eb668df4 n/a (xidlehook + 0x45df4)
                #8  0x000055a2eb68a5c1 n/a (xidlehook + 0x675c1)
                #9  0x000055a2eb684dbe n/a (xidlehook + 0x61dbe)
                #10 0x000055a2eb68fc90 n/a (xidlehook + 0x6cc90)
                #11 0x000055a2eb6885f3 n/a (xidlehook + 0x655f3)
                #12 0x000055a2eb68860d n/a (xidlehook + 0x6560d)
                #13 0x000055a2eb7a8b47 n/a (xidlehook + 0x185b47)
                #14 0x000055a2eb68fda2 main (xidlehook + 0x6cda2)
                #15 0x00007f77db3bdb25 __libc_start_main (libc.so.6 + 0x27b25)
                #16 0x000055a2eb65f07e n/a (xidlehook + 0x3c07e)

                Stack trace of thread 1621:
                #0  0x00007f77db48a37f __poll (libc.so.6 + 0xf437f)
                #1  0x00007f77db5e5654 n/a (libpulse.so.0 + 0x33654)
                #2  0x00007f77db5ce9a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
                #3  0x00007f77db5d9281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
                #4  0x00007f77db5d9331 pa_mainloop_run (libpulse.so.0 + 0x27331)
                #5  0x00007f77db5e97fe n/a (libpulse.so.0 + 0x377fe)
                #6  0x00007f77db35a5fc n/a (libpulsecommon-14.2.so + 0x565fc)
                #7  0x00007f77db575299 start_thread (libpthread.so.0 + 0x9299)
                #8  0x00007f77db495053 __clone (libc.so.6 + 0xff053)
 ericd@x1carbon6  ~ 