Bug 409296 - powermanagement data engine returns incorrect sleep states in login time
Summary: powermanagement data engine returns incorrect sleep states in login time
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: DataEngines (show other bugs)
Version: 5.16.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-29 03:34 UTC by Musikolo
Modified: 2023-10-11 16:39 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Musikolo 2019-06-29 03:34:35 UTC
SUMMARY
When logging in to KDE Plasma, powermanagement data engine returns incorrect "sleep state" values which breaks dependent plasmoids/widgets.

STEPS TO REPRODUCE
1. Install a plasmoid that depends on "sleep states" from powermanagement data engine (such as https://github.com/Musikolo/plasma5-applets-system-panel)
2. Reboot & log in to KDE Plasma
3. powermanagement returns incorrect values of "sleep states" for HybridSuspend, Hibernate and Suspend states.


OBSERVED RESULT
Because powermanagement returns incorrect "sleep states", dependent plasmoids do not work as expected. The returned "sleeps states" in login time are as shown below:

{"Hibernate":true,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}

Restarting plasmashell fixes the issue (kbuildsycoca5 && kquitapp5 plasmashell && kstart5 plasmashell). This suggests there might be a race condition on the normal log in process affecting some laptops.

EXPECTED RESULT
After logging in to KDE Plasma, powermanagement data engine "sleep states" should be correctly provided, as shown below:

{"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
I have widget that depends on powermanagement sleep states to decide whether to enable or not some related actions. Some version between KDE Plasma 5.8 & 5.16.2, I noticed my widget was behaving in an unexpected and incorrect way. Recently, I decided to improve the code and debug the issue.

Logs when the issue occurs:

powermanagement onNewData sourceName=Sleep States - data={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false} - Sleep States={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}
powermanagement onNewData sourceName=Sleep States - data={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false} - Sleep States={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}
powermanagement source connected=Sleep States - Sleep States={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}
powermanagement source connected=PowerDevil - Sleep States={"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}
suspendToRam - Sleep States={"objectName":"","Sleep States":{"Hibernate":false,"HybridSuspend":false,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":false}}


Logs when EITHER the issue does NOT occur OR after restarting plasmashell:

powermanagement onNewData sourceName=Sleep States - data={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true} - Sleep States={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}
powermanagement onNewData sourceName=Sleep States - data={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true} - Sleep States={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}
powermanagement source connected=Sleep States - Sleep States={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}
powermanagement source connected=PowerDevil - Sleep States={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}
suspendToRam - Sleep States={"objectName":"","Sleep States":{"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}}
powermanagement source connected=Sleep States - Sleep States={"Hibernate":true,"HybridSuspend":true,"LockScreen":true,"Logout":true,"Standby":false,"Suspend":true}


I found the issue is not reproducible in all my 3 laptops:
    - Slimbook Pro : It does happen
    - Slimbook Pro2: It does happen
    - Lenovo E480  : It does NOT happen

All these 3 laptops use up-to-date Arch Linux distros.

If you need further detail or want me to test anything, please let me know.

Thank you!
Comment 1 Kai Uwe Broulik 2019-07-01 06:52:19 UTC
Hmm possible that plasmashell starts before powerdevil is up and then the dataengine never re-checks
Comment 2 Squ33z3r 2019-07-02 07:47:50 UTC
I think I have an issue that has the same root cause: Sometimes when I start my PC, the KDE Application menu does not offer to suspend my PC (the button is just not there).

However, using 'systemctl suspend' works just fine. And after a while (I have not determined the pattern yet, but read it as 'days'), the suspend option reappears in the menu.

So yesterday, when the suspend entry was missing I tried restarting plasma via 'kbuildsycoca5 && kquitapp5 plasmashell && kstart5 plasmashell' and afterward, the suspend entry was instantly there.

My PC is running Arch Linux too and the versions of KDE/Plasma/Qt are the same as Musikolos, but I have this problem for a few months now.
Comment 3 David Edmundson 2019-07-02 07:49:37 UTC
I'm landing some new code that simplifies our power management api for 5.17

Probably not worth spending too much time on till we see if that fixes it.
Comment 4 Musikolo 2019-10-25 01:57:16 UTC
The issue still persists in KDE Plasma 5.17.1. 

Is there any tentative version in which this will be fixed?

Thank you!
Comment 5 Squ33z3r 2020-01-17 09:54:54 UTC
I can confirm the issue is still present in Plasma 5.17.5
Comment 6 Nate Graham 2023-09-19 20:21:34 UTC
Hello and thank you again for the bug report! Unfortunately we were not able to address it yet, nor even manage to reproduce the issue ourselves. Can we ask you to please check if this issue is still happening with Plasma 5.27?

If it is, please change the status to REPORTED. Thanks a lot!
Comment 7 Bug Janitor Service 2023-10-04 03:46:32 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Squ33z3r 2023-10-04 18:21:02 UTC
With Plasma 5.27.8 I was unable to replicate it. As far as I remember it, the issue did not occur every time, but over the past week, I was unable to recognize it.

My system is still the same, but due to other problems with the suspend mode (graphics driver problems), I haven't used it very often for the past months.
Comment 9 Nate Graham 2023-10-11 16:39:19 UTC
Ok, thanks a lot!