swaywm / swayidle

Idle management daemon for Wayland
MIT License
550 stars 50 forks source link

randomly unable to suspend correctly #130

Closed primalmotion closed 2 years ago

primalmotion commented 2 years ago

I use this command

swayidle -d -w \
        timeout 5 lockscreen.sh \
        timeout 10 suspend.sh resume resume.sh \
        before-sleep lockscreen.sh \
        after-resume resume.sh

while most the time everything works as expected with such small timeout, sometimes it fails ti suspend. (or rather, it suspends then immediately wakes up)

Here's the log for a successfull operation

# SLEEPING

2022-09-15 10:33:11 - [Line 633] idle state
2022-09-15 10:33:11 - [Line 143] Cmd exec lockscreen.sh
2022-09-15 10:33:11 - [Line 169] Spawned process lockscreen.sh
2022-09-15 10:33:11 - [Line 171] Blocking until process exits
2022-09-15 10:33:13 - [Line 176] Process exit status: 0
2022-09-15 10:33:16 - [Line 633] idle state
2022-09-15 10:33:16 - [Line 143] Cmd exec suspend.sh
2022-09-15 10:33:16 - [Line 169] Spawned process suspend.sh
2022-09-15 10:33:16 - [Line 171] Blocking until process exits
2022-09-15 10:33:18 - [Line 176] Process exit status: 0
2022-09-15 10:33:18 - [Line 344] PropertiesChanged signal received
2022-09-15 10:33:18 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager
2022-09-15 10:33:18 - [Line 293] PrepareForSleep signal received 1
2022-09-15 10:33:18 - [Line 143] Cmd exec lockscreen.sh
2022-09-15 10:33:18 - [Line 169] Spawned process lockscreen.sh
2022-09-15 10:33:18 - [Line 171] Blocking until process exits
2022-09-15 10:33:18 - [Line 176] Process exit status: 0
2022-09-15 10:33:18 - [Line 308] Prepare for sleep done
2022-09-15 10:33:18 - [Line 232] Releasing inhibitor lock 11
2022-09-15 10:33:18 - [Line 344] PropertiesChanged signal received
2022-09-15 10:33:18 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager
2022-09-15 10:33:18 - [Line 344] PropertiesChanged signal received
2022-09-15 10:33:18 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager

## RESUMING

2022-09-15 10:33:36 - [Line 293] PrepareForSleep signal received 0
2022-09-15 10:33:36 - [Line 220] Got sleep lock: 12
2022-09-15 10:33:36 - [Line 143] Cmd exec resume.sh
2022-09-15 10:33:36 - [Line 169] Spawned process resume.sh
2022-09-15 10:33:36 - [Line 171] Blocking until process exits
2022-09-15 10:33:37 - [Line 176] Process exit status: 0
2022-09-15 10:33:38 - [Line 647] active state
2022-09-15 10:33:38 - [Line 143] Cmd exec resume.sh
2022-09-15 10:33:38 - [Line 169] Spawned process resume.sh
2022-09-15 10:33:38 - [Line 171] Blocking until process exits
2022-09-15 10:33:39 - [Line 176] Process exit status: 0
2022-09-15 10:33:39 - [Line 647] active state

And here's one for a failed early resuming

## SLEEPING

2022-09-15 10:37:31 - [Line 633] idle state
2022-09-15 10:37:31 - [Line 143] Cmd exec lockscreen.sh
2022-09-15 10:37:31 - [Line 169] Spawned process lockscreen.sh
2022-09-15 10:37:31 - [Line 171] Blocking until process exits
2022-09-15 10:37:32 - [Line 176] Process exit status: 0
2022-09-15 10:37:36 - [Line 633] idle state
2022-09-15 10:37:36 - [Line 143] Cmd exec suspend.sh
2022-09-15 10:37:36 - [Line 169] Spawned process suspend.sh
2022-09-15 10:37:36 - [Line 171] Blocking until process exits
2022-09-15 10:37:37 - [Line 176] Process exit status: 0
2022-09-15 10:37:37 - [Line 344] PropertiesChanged signal received
2022-09-15 10:37:37 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager
2022-09-15 10:37:37 - [Line 344] PropertiesChanged signal received
2022-09-15 10:37:37 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager
2022-09-15 10:37:37 - [Line 293] PrepareForSleep signal received 1
2022-09-15 10:37:37 - [Line 143] Cmd exec lockscreen.sh
2022-09-15 10:37:37 - [Line 169] Spawned process lockscreen.sh
2022-09-15 10:37:37 - [Line 171] Blocking until process exits
2022-09-15 10:37:37 - [Line 176] Process exit status: 0
2022-09-15 10:37:37 - [Line 308] Prepare for sleep done
2022-09-15 10:37:37 - [Line 232] Releasing inhibitor lock 12
2022-09-15 10:37:37 - [Line 344] PropertiesChanged signal received
2022-09-15 10:37:37 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager
2022-09-15 10:37:37 - [Line 344] PropertiesChanged signal received    <--------
2022-09-15 10:37:37 - [Line 352] Got PropertyChanged: org.freedesktop.login1.Manager <----------

## RESUMING

2022-09-15 10:37:49 - [Line 293] PrepareForSleep signal received 0
2022-09-15 10:37:49 - [Line 220] Got sleep lock: 12
2022-09-15 10:37:49 - [Line 143] Cmd exec resume.sh
2022-09-15 10:37:49 - [Line 169] Spawned process resume.sh
2022-09-15 10:37:49 - [Line 171] Blocking until process exits
2022-09-15 10:37:50 - [Line 176] Process exit status: 0
2022-09-15 10:37:58 - [Line 647] active state
2022-09-15 10:37:58 - [Line 143] Cmd exec resume.sh
2022-09-15 10:37:58 - [Line 169] Spawned process resume.sh
2022-09-15 10:37:58 - [Line 171] Blocking until process exits
2022-09-15 10:37:59 - [Line 176] Process exit status: 0
2022-09-15 10:37:59 - [Line 647] active state

As you can see it seems there's an additional signal received that causes troubles. This is happening like once out of 5 times with the small timeouts, but almost 100% of the times with timeouts sets to 300 and 360.

I'm not sure what's the problem here.

I tried with latest swayidle release, as well as the latest master

primalmotion commented 2 years ago

ok.. so it's not swayidls' fault or systemd's, or anything else. My corporate network continuously sends WoL magic packets... disabled it and it now seems to work. Sorry for the noise