Issue metadata
Sign in to add a comment
|
AdMob Native Ads causes high cpu usage even with test app in background
Reported by
alv...@opera.com,
Oct 31
|
||||||||||||||||||||||
Issue descriptionChrome Version : 70.0.3538.80 What steps will reproduce the problem? (1) Restart device. Don't start any apps (2) Run a systrace (trace_fresh_start.html) (3) Build NativeAdvancedExample from https://github.com/googleads/googleads-mobile-android-examples and launch it on an android device (tested on Android 7.0, 8.0 and 8.1) (4) Navigate away from the test app (but don't destroy it) (5) Turn off the screen (6) Run a systrace (trace_after_showing_admob_native_ad.html) (7) Destroy test app (8) Run a systrace (trace_admob_test_app_destroyed.html) What is the expected result? The trace after showing an admob native ad should look similar to the baseline trace recorded on a newly restarted device What happens instead? There seem to be multiple VSync listeners sticking around, causing excessive CPU usage. Even when the test app is exited completely, a listener seems to stick around in com.google.android.gms. Please provide any additional information below. Attach a screenshot if possible. Uninstalling/deactivating Chrome makes the listeners go away.
,
Nov 1
,
Nov 13
Switching this to Bug-Regression due to comment above. What can we do to move this along? It's very concerning to have this out in the field since it means user's battery usage will likely be increased significantly and when looking at battery stats it will be whatever app that happens to use AdMob ads (which are many as far as I know) that will be blamed. I don't think those apps can do much besides switching off ads to work around this which is a step I'm sure neither apps nor AdMob prefers.
,
Nov 13
Reverting https://chromium-review.googlesource.com/c/chromium/src/+/1150961/ fixes this. I don't have a full explanation in my head yet. Scheduler state below. needs_prepare_tiles_ is true (fine) visible_ is true (a bit surprising) can_draw_ is false (dunno what's setting it to false yet) So we spin begin frame, but don't invalidate because can_draw_ is false. Questions: * what's causing can_draw_ to be false? * why is visible_ true when the app is in the background? this can happen on detached webviews, but need to confirm that * why does invalidate actually fix this? I mean if webview is detached or otherwise not visible onscreen, what's responding to invalidate with draw? * can we do better here? if we need to prepare tiles but can_draw_ is false, should we just prepare tiles with a delay or something? Also noticed all the vsyncs are serialized on the UI thread. I wonder when we broke that :/ {state_machine: {major_state: {next_action: "Action::NONE", begin_impl_frame_state: "BeginImplFrameState::INSIDE_BEGIN_FRAME", begin_main_frame_state: "BeginMainFrameState::IDLE", layer_tree_frame_sink_state: "LayerTreeFrameSinkState::ACTIVE", forced_redraw_state: "ForcedRedrawOnTimeoutState::IDLE"}, minor_state: {commit_count: 2, current_frame_number: 7857, last_frame_number_submit_performed: -1, last_frame_number_draw_performed: 9, last_frame_number_begin_main_frame_sent: 9, did_draw: true, did_send_begin_main_frame_for_current_frame: false, did_notify_begin_main_frame_not_sent: false, wants_begin_main_frame_not_expected: false, did_commit_during_frame: false, did_invalidate_layer_tree_frame_sink: false, did_perform_impl_side_invalidaion: false, did_prepare_tiles: false, consecutive_checkerboard_animations: 0, pending_submit_frames: 0, submit_frames_with_current_layer_tree_frame_sink: 0, needs_redraw: false, needs_prepare_tiles: true, needs_begin_main_frame: false, needs_one_begin_impl_frame: false, visible: true, begin_frame_source_paused: false, can_draw: false, resourceless_draw: false, has_pending_tree: false, pending_tree_is_ready_for_activation: false, active_tree_needs_first_draw: false, active_tree_is_ready_to_draw: true, did_create_and_initialize_first_layer_tree_frame_sink: true, tree_priority: "NEW_CONTENT_TAKES_PRIORITY", scroll_handler_state: "SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER", critical_begin_main_frame_to_activate_is_fast: false, main_thread_missed_last_deadline: false, skip_next_begin_main_frame_to_reduce_latency: false, video_needs_begin_frames: false, defer_commits: false, last_commit_had_no_updates: false, did_draw_in_last_frame: false, did_submit_in_last_frame: false, needs_impl_side_invalidation: false, current_pending_tree_is_impl_side: false, previous_pending_tree_was_impl_side: false}},
,
Nov 13
> what's causing can_draw_ to be false? webview is 0x0 > why is visible_ true when the app is in the background? Yep, these are detached webviews except one. That one attached does become invisible when app is background. > * why does invalidate actually fix this? App is not responding to invalidates as I originally suspected. Before my CL, cc scheduler does call invalidate up with needs_draw=false if it's only required for prepare tiles. Then we have a shortcut for these that do not involve os or app code. So fix is pretty easy. Keep invalidating if it's for needs_prepare_tiles
,
Nov 13
https://chromium-review.googlesource.com/c/chromium/src/+/1334550
,
Nov 13
> Also noticed all the vsyncs are serialized on the UI thread. I wonder when we broke that :/ Oh it's not broken. It's just that each webview is passed a different context, and we've only ever tried to optimize for webviews with the same context.
,
Nov 14
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/43a7801fe8d646b7099d5e72a151c8eab5a3bffc commit 43a7801fe8d646b7099d5e72a151c8eab5a3bffc Author: Bo Liu <boliu@chromium.org> Date: Wed Nov 14 02:33:06 2018 cc: Invalidate for needs_prepare_tiles Problem is when CanDraw is false but needs_prepare_tiles is true Scheduler will keep requesting begin frames but do nothing in a begin frame since invalidate is blocked on CanDraw. We already have an efficient shortcut that does not involve actually producing a frame if invalidate is only requested for needs_prepare_tiles. So the simple fix is simply allow invalidates for this case. Bug: 900557 Change-Id: Ib3c3e213e2e2461d7aa1b8dd8d2e91ab64042feb Reviewed-on: https://chromium-review.googlesource.com/c/1334550 Commit-Queue: Bo <boliu@chromium.org> Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org> Cr-Commit-Position: refs/heads/master@{#607876} [modify] https://crrev.com/43a7801fe8d646b7099d5e72a151c8eab5a3bffc/cc/scheduler/scheduler_state_machine.cc [modify] https://crrev.com/43a7801fe8d646b7099d5e72a151c8eab5a3bffc/cc/scheduler/scheduler_unittest.cc
,
Nov 14
,
Nov 19
No issues on canary. Change only impacts webview
,
Nov 19
This bug requires manual review: M71 has already been promoted to the beta branch, so this requires manual review Please contact the milestone owner if you have questions. Owners: benmason@(Android), kariahda@(iOS), kbleicher@(ChromeOS), govind@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 19
Approved for merge to 71, branch 3578.
,
Nov 20
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/95e44621f06a1c3ffab2e3f860042da2fb254e48 commit 95e44621f06a1c3ffab2e3f860042da2fb254e48 Author: Bo Liu <boliu@chromium.org> Date: Tue Nov 20 04:39:44 2018 [Merge M71] cc: Invalidate for needs_prepare_tiles Problem is when CanDraw is false but needs_prepare_tiles is true Scheduler will keep requesting begin frames but do nothing in a begin frame since invalidate is blocked on CanDraw. We already have an efficient shortcut that does not involve actually producing a frame if invalidate is only requested for needs_prepare_tiles. So the simple fix is simply allow invalidates for this case. (cherry picked from commit 43a7801fe8d646b7099d5e72a151c8eab5a3bffc) Bug: 900557 Change-Id: Ib3c3e213e2e2461d7aa1b8dd8d2e91ab64042feb Reviewed-on: https://chromium-review.googlesource.com/c/1334550 Commit-Queue: Bo <boliu@chromium.org> Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#607876} Reviewed-on: https://chromium-review.googlesource.com/c/1343663 Reviewed-by: Bo <boliu@chromium.org> Cr-Commit-Position: refs/branch-heads/3578@{#769} Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034} [modify] https://crrev.com/95e44621f06a1c3ffab2e3f860042da2fb254e48/cc/scheduler/scheduler_state_machine.cc [modify] https://crrev.com/95e44621f06a1c3ffab2e3f860042da2fb254e48/cc/scheduler/scheduler_unittest.cc
,
Nov 20
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/95e44621f06a1c3ffab2e3f860042da2fb254e48 Commit: 95e44621f06a1c3ffab2e3f860042da2fb254e48 Author: boliu@chromium.org Commiter: boliu@chromium.org Date: 2018-11-20 04:39:44 +0000 UTC [Merge M71] cc: Invalidate for needs_prepare_tiles Problem is when CanDraw is false but needs_prepare_tiles is true Scheduler will keep requesting begin frames but do nothing in a begin frame since invalidate is blocked on CanDraw. We already have an efficient shortcut that does not involve actually producing a frame if invalidate is only requested for needs_prepare_tiles. So the simple fix is simply allow invalidates for this case. (cherry picked from commit 43a7801fe8d646b7099d5e72a151c8eab5a3bffc) Bug: 900557 Change-Id: Ib3c3e213e2e2461d7aa1b8dd8d2e91ab64042feb Reviewed-on: https://chromium-review.googlesource.com/c/1334550 Commit-Queue: Bo <boliu@chromium.org> Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#607876} Reviewed-on: https://chromium-review.googlesource.com/c/1343663 Reviewed-by: Bo <boliu@chromium.org> Cr-Commit-Position: refs/branch-heads/3578@{#769} Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
,
Nov 20
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by sberg...@opera.com
, Oct 31Labels: OS-Android