New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 761248 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 704408
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Chrome should avoid sending initial default power management policy when restarting in kiosk mode

Project Member Reported by derat@chromium.org, Sep 1 2017

Issue description

There have been a lot of reports of Chrome OS devices that are running kiosk apps, or CfM devices, unexpectedly suspending:

issue 752312
issue 738631
issue 729609
issue 715257
http://b/65174186
etc.

The powerd logs from these feedback reports always show powerd happily keeping the system awake in response to a policy from a Chrome app or extension using the chrome.power API:

[0829/080713:INFO:daemon.cc(1414)] Received updated external policy: ac_dim=0s ac_screen_off=0s ac_lock=0s ac_idle_warn=0s ac_idle=30m battery_dim=0s battery_screen_off=0s battery_lock=0s battery_idle_warn=0s battery_idle=10m ac_idle=no-op battery_idle=no-op lid_closed=no-op use_audio=1 use_video=1 presentation_factor=2.0 user_activity_factor=2.0 wait_for_initial_user_activity=0 force_nonzero_brightness_for_user_activity=1 (Prefs, extension)

At some point, Chrome restarts for an unknown reason:

[0829/080714:INFO:suspend_delay_controller.cc(123)] Unregistering suspend delay 42860546 (chrome) due to D-Bus client :1.15 going away
[0829/080714:INFO:suspend_delay_controller.cc(123)] Unregistering dark suspend delay 42893314 (chrome) due to D-Bus client :1.15 going away
[0829/080714:INFO:suspend_delay_controller.cc(62)] Registering suspend delay 42860548 (chrome) of 5000 ms on behalf of :1.108
[0829/080714:INFO:suspend_delay_controller.cc(62)] Registering dark suspend delay 42893315 (chrome) of 5000 ms on behalf of :1.108

Then Chrome sends powerd a default policy no longer including the keep-awake request from the app:

[0829/080714:INFO:daemon.cc(1414)] Received updated external policy: ac_dim=7m ac_screen_off=8m ac_lock=0s ac_idle_warn=0s ac_idle=30m battery_dim=5m battery_screen_off=6m battery_lock=0s battery_idle_warn=0s battery_idle=10m ac_idle=suspend battery_idle=suspend lid_closed=suspend use_audio=1 use_video=1 presentation_factor=2.0 user_activity_factor=2.0 wait_for_initial_user_activity=0 force_nonzero_brightness_for_user_activity=1 (Prefs)

And then powerd suspends the system (as expected).

I thought that the app wasn't getting restarted at all, but choonc@ noticed that in at least some cases, Chrome actually restarts the app, which dutifully uses chrome.power again to try to keep the system awake, but it's too late at that point: powerd has already started suspending.

I don't know anything about the Chrome startup flow for kiosk apps or CfM (is it the same between the two cases?), but perhaps Chrome ought to hold off on sending the initial default power management policy to powerd until the app has had time to reacquire its request using chrome.power. For example, maybe Chrome could create a device::PowerSaveBlocker with kPowerSaveBlockPreventDisplaySleep at startup when running in this mode and hold it for ~30 seconds to give the app time to start.

Can someone who knows more about the startup flow when using these apps (Rahul?) provide some details about it?
 

Comment 1 by derat@chromium.org, Sep 1 2017

Cc: bartfab@chromium.org atwilson@chromium.org
Alternately, I could very quickly add a hack to powerd to treat a Chrome restart as user activity, which would reset powerd's inactivity timer. I need to think more about whether that would have any unexpected side effects (e.g. it'd also be triggered if Chrome crashes and is restarted, but that doesn't immediately seem like a problem).

I suspect that the proper fix is for Chrome to avoid sending a default power management policy when it restarts, though, since that seems like it could also have other unwanted consequences.
Cc: felixe@chromium.org xiy...@chromium.org mnilsson@chromium.org
The unknown browser restart could possibly be because of a packaged app reload. It appears chrome.runtime.reload() currently restart Chrome, https://crbug.com/759811. I'm looking into the usage of chrome.runtime.reload() now.

Comment 3 by derat@chromium.org, Sep 1 2017

I uploaded the powerd workaround at https://chromium-review.googlesource.com/647795.

We probably wouldn't want to merge it to any earlier branches, as I'm still concerned about the potential for it to cause undesirable behavior.

Comment 4 by derat@chromium.org, Sep 5 2017

Cc: r...@chromium.org
Owner: derat@chromium.org
I'm leaning toward trying to fix this using the change I proposed earlier at  issue 704408  (2-3 birds with one stone, etc.). I was never able to convince anyone on the enterprise side to tell me it was a horrible idea, so why not? :-D

Comment 5 by derat@chromium.org, Sep 6 2017

Mergedinto: 704408
Status: Duplicate (was: Assigned)
I think that  issue 704408  is a better way of working around this.

Sign in to add a comment