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

Issue 735060 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Hung WebApk onResume

Project Member Reported by yfried...@chromium.org, Jun 20 2017

Issue description

I'm on the Android O beta and testing on Chrome Dev 61.0.3129.3

What I'm seeing is occasionally a WebApk hung and never leaving the splash screen.

I looked at some logs and I see the following for 2 different renderer process launches:


06-20 10:46:49.825 918-2154/? I/ActivityManager: Start proc 19592:com.chrome.dev:sandboxed_process0/u0i489 for service com.chrome.dev/org.chromium.content.app.SandboxedProcessService0
06-20 10:46:50.129 19592-19592/? W/dboxed_process0: type=1400 audit(0.0:10469): avc: denied { getattr } for path="/data/data/com.chrome.dev" dev="sda35" ino=893559 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
06-20 10:46:50.189 19592-19592/? W/dboxed_process0: type=1400 audit(0.0:10470): avc: denied { search } for name="tmp" dev="sda35" ino=32770 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-20 10:46:50.218 19592-19592/? I/cr_ChildProcessService: Creating new ChildProcessService pid=19592
06-20 10:46:51.204 19592-19606/? I/cr_LibraryLoader: Time to load native libraries: 60 ms (timestamps 7545-7605)
06-20 10:46:51.206 19592-19606/? I/cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
06-20 10:46:51.208 19592-19606/? I/chromium: [INFO:library_loader_hooks.cc(144)] Chromium logging enabled: level = 0, default verbosity = 0
06-20 10:46:51.208 19592-19606/? I/cr_LibraryLoader: Expected native library version number "61.0.3129.3", actual native library version number "61.0.3129.3"

06-20 10:47:01.132 918-8515/? I/ActivityManager: Start proc 19791:com.chrome.dev:sandboxed_process1/u0i490 for service com.chrome.dev/org.chromium.content.app.SandboxedProcessService1
06-20 10:47:01.789 19791-19791/? W/dboxed_process1: type=1400 audit(0.0:10472): avc: denied { getattr } for path="/data/data/com.chrome.dev" dev="sda35" ino=893559 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
06-20 10:47:01.853 19791-19791/? W/dboxed_process1: type=1400 audit(0.0:10473): avc: denied { search } for name="tmp" dev="sda35" ino=32770 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-20 10:47:01.880 19791-19791/? I/cr_ChildProcessService: Creating new ChildProcessService pid=19791




Where the second renderer (19791) never logs that it loaded native libraries.

The steps that I observed to repro were:
1) launch 2 different webapks
2) use different apps so that chrome gets evicted due to memory pressure
3) relaunch one webapk (works fine, first logs above)
4) relaunch another webapk and hangs forever.

Unfortunately that was on a user build so I'm now trying to repro on trunk with dev build. What's different from other issues I've seen that appear related is that in this case it's the second webapk that's broken, and so unlikely to be caused by the warmup renderer.

Addding Bo/Jay in case you've seen something similar recently but still trying to dig into this.
What's dif
 
Cc: twelling...@chromium.org dfalcant...@chromium.org
Summary: Hung WebApk onResume (was: Hung renderer )
Ok, I don't think this has anything to do with ChildProcessLauncher and is instead a bug in tab restore for FullScreenActivity.

Still trying to sort it out exactly, but in debug mode, I'm actually hitting an assert here: https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java?q=%22+assert+creationState+!%3D+TabCreationState.FROZEN_ON_RESTORE%22+package:%5Echromium$&l=528

If I skip the assert, I get a hung renderer as in release builds.
This logic has long since been evicted from my memory but it seems like we think we can restore some history for the full-screen tab but then fail to do so and end up in an inconsistent state
+twellington,dfalcantara
Cc: peconn@chromium.org
+peconn@ - this seems like it could be related to the picture-in-picture work for Android O that moved fullscreen web content to a new Activity.
Hmm, I think I'm onto something.
WebappDirectoryManager.findStaleWebappDirectories.
It seems to be nuking WebApk history files cause they're similar (but different) from Webapp. They're close enough that it looks like it's processing them, but it's really not and ends up deleting valid history elements. We just missed this while making webapks work cause there wasn't enough usage to see this history problem.
Cc: -boliu@chromium.org -jcivelli@chromium.org dominickn@chromium.org pkotw...@chromium.org hanxi@chromium.org
So the simplest fix is to change WebApkConstants.WEBAPK_ID_PREFIX from "webapk:" to "webapk-". This is because WebappDirectoryManager gets the intent's host while looking for live apps and using "webapk:..." means that the host is always "webapk". Not sure if there's any reason not to do this, but some local testing seems to check out.
Of course that entails being able to migrate over existing shared prefs from one place to the other (e.g. webapp_webapk:org.chromium.webapk.a4b4240ee93f1a289.xml ->webapp_webapk-org.chromium.webapk.a4b4240ee93f1a289.xml) :S
Xi pointed out yesterday that WebappDataStorage does not have any critical data for WebAPKs. WebappDataStorage mostly has timestamps that we use to determine when to next update WebAPKs. We wouldn't be sad if we lost all of the data in WebappDataStorage. However, we would need to ensure that we delete data in the old WebappDataStorage
> However, we would need to ensure that we delete data in the old WebappDataStorage

Don't these automatically age out after some period of time?
WebappRegistry.unregisterOldWebapps will already clear unused storage after 28 days but that's for webapps. For webapks, it just checks whether it's installed and both entries would map to an installed webapk.
At the end of the day though, it's a tiny amount of on-disk storage. Each webapk is <1k of shared prefs
I have a patch that CQ seems happy with up at https://codereview.chromium.org/2952023002/#msg3 but I still want to add tests
Project Member

Comment 10 by bugdroid1@chromium.org, Jun 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5ff213a88961f80fab0e21a871b62eb4336f3cb0

commit 5ff213a88961f80fab0e21a871b62eb4336f3cb0
Author: yfriedman <yfriedman@chromium.org>
Date: Mon Jun 26 14:21:32 2017

Change WebApk app-id prefix from 'webapk:' to 'webapk-'

This fixes some code which uses the host of a WebApp for various processing.
Specifically, when examining history state
(https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDirectoryManager.java?type=cs&q=liveWebapps.add+package:%5Echromium$&l=111)
this would fail because 'webapk:' becomes the host name.

This also makes WebApk id's consistent with traditional A2HS ids.
Finally, this includes a change to the cleanup routine run on WebApps to age out the old entries.
We will lose install source as part of this but it's just metrics book-keeping for us and doesn't affect users.
BUG= 735060 , 735722 

Review-Url: https://codereview.chromium.org/2952023002
Cr-Commit-Position: refs/heads/master@{#482267}

[modify] https://crrev.com/5ff213a88961f80fab0e21a871b62eb4336f3cb0/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
[modify] https://crrev.com/5ff213a88961f80fab0e21a871b62eb4336f3cb0/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java
[modify] https://crrev.com/5ff213a88961f80fab0e21a871b62eb4336f3cb0/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
[modify] https://crrev.com/5ff213a88961f80fab0e21a871b62eb4336f3cb0/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java

Labels: M-60 Merge-Request-60
Haven't heard any issues on this and it's been working for me on dev chanel
Project Member

Comment 12 by sheriffbot@chromium.org, Jun 30 2017

Labels: -Merge-Request-60 Hotlist-Merge-Review Merge-Review-60
This bug requires manual review: M60 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), josafat@(ChromeOS), bustamante@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
So the issue here is if a user opesn multiple wbapks, then chrome goes to the background and is evicted from memory. When user relaunches chrome, if/when they try a second webapk, they'll be stuck on the splashcreen forever cause the page isn't initialized. WOrkaroudn is to hit back or home and try again.
Labels: -Merge-Review-60 Merge-Approved-60
Spoke with yfriedman@ offline on this, the breakage is pretty bad when it does occur and the code only affects WebAPKs - thus approved for M60 branch 3112.
Project Member

Comment 15 by bugdroid1@chromium.org, Jul 10 2017

Labels: -merge-approved-60 merge-merged-3112
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8b2a6269e945ebf038f2377f3637b044deff6aa1

commit 8b2a6269e945ebf038f2377f3637b044deff6aa1
Author: Yaron Friedman <yfriedman@chromium.org>
Date: Mon Jul 10 17:26:56 2017

Change WebApk app-id prefix from 'webapk:' to 'webapk-'

This fixes some code which uses the host of a WebApp for various processing.
Specifically, when examining history state
(https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDirectoryManager.java?type=cs&q=liveWebapps.add+package:%5Echromium$&l=111)
this would fail because 'webapk:' becomes the host name.

This also makes WebApk id's consistent with traditional A2HS ids.
Finally, this includes a change to the cleanup routine run on WebApps to age out the old entries.
We will lose install source as part of this but it's just metrics book-keeping for us and doesn't affect users.
BUG= 735060 , 735722 
TBR=pkotwicz

(cherry picked from commit 5ff213a88961f80fab0e21a871b62eb4336f3cb0)

Review-Url: https://codereview.chromium.org/2952023002
Cr-Original-Commit-Position: refs/heads/master@{#482267}
Change-Id: Ib52aea4f06752504b697f9d2e81ad22ec65c0be7
Reviewed-on: https://chromium-review.googlesource.com/565463
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/branch-heads/3112@{#558}
Cr-Branched-From: b6460e24cf59f429d69de255538d0fc7a425ccf9-refs/heads/master@{#474897}
[modify] https://crrev.com/8b2a6269e945ebf038f2377f3637b044deff6aa1/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
[modify] https://crrev.com/8b2a6269e945ebf038f2377f3637b044deff6aa1/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappDirectoryManagerTest.java
[modify] https://crrev.com/8b2a6269e945ebf038f2377f3637b044deff6aa1/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
[modify] https://crrev.com/8b2a6269e945ebf038f2377f3637b044deff6aa1/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java

Status: Fixed (was: Started)

Sign in to add a comment