Hello,
I'm trying to diagnose an intermittent power-management problem on a Windows 11 laptop.
The laptop is a Lenovo Legion with Windows 11. I use it with the lid closed while connected to AC power. The lid-close action is configured so that the laptop continues running. A Python script runs continuously in the background.
This setup worked reliably for several weeks. Recently, however, the laptop sometimes unexpectedly stops running the script after being left alone for an unpredictable amount of time (roughly 1–4 hours).
When I open the lid again, Windows resumes and the Python script continues normally. The script is meant to be running the whole time, though.
I have encountered this behavior several times, but unfortunately it is annoying to reproduce this actively, because the waiting time varies significantly.
Power configuration
The active power plan is Balanced.
For AC power:
- Sleep after: 0 seconds (Never)
- Hibernate after: 0 seconds (Never)
- Hybrid sleep: Off
- Wake timers: Enabled
The system supports S3 and S4:
The following sleep states are available:
Standby (S3)
Hibernate
Fast Startup
The following sleep states are not available:
Standby (S0 Low Power Idle)
Hibernate was enabled manually with:
powercfg /hibernate on
The problem may have started around the same period, although I am not certain whether the first occurrence was shortly after enabling or days later.
Event sequence
The most recent occurrence produced the following events immediately before the sleep/hibernate transition.
Kernel-Power Event 105:
AcOnline: false
RemainingCapacity: 68560
FullChargeCapacity: 85690
(laptop is set up to only charge to 80% battery, hence the discrepancy)
Then Event 566:
Reason: 28
PreviousSessionId: 21
PreviousSessionType: 1
PreviousSessionDurationInUs: 3786114240
NextSessionId: 23
NextSessionType: 1
PowerStateAc: false
MonitorReason: 28
Then another Event 566:
Reason: 20
PreviousSessionId: 23
PreviousSessionType: 1
PreviousSessionDurationInUs: 8966
NextSessionId: 25
NextSessionType: 3
PowerStateAc: false
MonitorReason: 20
There were also two IsolatedUserMode events (ID 1 and 5, details on one:
Secure Trustlet ??\C:\WINDOWS\system32\BioIso.exe Id 4 and Pid 38988 started with status STATUS_SUCCESS.)
, followed by:
Kernel-Power Event 105:
AcOnline: true
RemainingCapacity: 68560
FullChargeCapacity: 85690
Then, about 0.25 seconds later:
Kernel-Power Event 42:
TargetState: 4
EffectiveState: 4
Reason: 0
Flags: 4
TransitionsToOn: 3
I understand that TargetState = 4 corresponds to S4/hibernate.
About 3 seconds later:
Kernel-Power Event 107:
TargetState: 4
EffectiveState: 4
WakeFromState: 4
ProgrammedWakeTimeAc: 1601-01-01T00:00:00.0000000Z
ProgrammedWakeTimeDc: 1601-01-01T00:00:00.0000000Z
WakeRequesterTypeAc: 0
WakeRequesterTypeDc: 0
This, I strongly assume, is not actually happening 3 seconds later, but when I open the lid of the laptop, just that it writes this event with the system time it had before entering sleep - because the next entry is something about changing the system time to the actual time.
The particularly strange part to me is:
AcOnline = false
immediately before the transition, followed by:
AcOnline = true
less than a second later.
The laptop was physically connected to AC power the entire time and nobody touched it.
After opening the laptop, I also ran:
powercfg /lastwake
which reported:
Wake History Count - 1
Wake History [0]
Wake Source Count - 1
Wake Source [0]
Type: Fixed Feature
Power Button
Other observations
In earlier occurrences I saw:
- Event 42:
Sleep Reason: Button or Lid
- Event 107 a few seconds later
- Event 566 with
Reason InputMouse
- Event 566 with
Reason SxTransition
- Event 40 indicating that the HP WSD printer and scanner drivers stopped the power transition.
The HP printer is connected over Wi-Fi and has not changed - plus it was off or on standby. A Bluetooth mouse is also present, but it was physically switched off when the event occurred.
The laptop, charger, power outlet, printer and mouse had all been unchanged for weeks before this problem started.
Windows update history shows:
- KB5095189 — July 15
- KB5123304 — August 12
- KB5121003 — August 12
- KB5120708 — August 12
Lenovo's last update was in July.
I am uncertain whether the behavior started before Aug 12 or after, but my memory thinks it started a few days before that. I would strongly assume that enabling Hibernation Mode is the culprit.
My questions
- Does the Event 105
AcOnline=false → AcOnline=true sequence indicate that Windows/ACPI actually detected a brief loss of AC power?
- Could a very brief AC-power/charger detection event cause Windows to transition from the AC power plan and subsequently enter S4?
- Is there a way to determine what generated the transition to S4—for example, whether it came from ACPI/firmware, the lid sensor, a driver, or Windows power policy?
- Is there a more appropriate diagnostic tool/log than Event Viewer for investigating this? I am happy to provide
powercfg reports or ETW traces if someone can tell me which ones would be useful.
- Could enabling Hibernate (
powercfg /hibernate on) plausibly be related to this behavior?
My main requirement is simply that when the laptop is plugged in and the lid is closed, it must remain awake indefinitely. I would like to understand the cause rather than simply disabling every possible power-saving feature.
Any help interpreting the Event 105/566/42/107 sequence would be greatly appreciated