WebView AwDataDirLock crash on some Samsung Galaxy S21 devices (Android 12)
Asked Answered
R

0

8

Since November 25, I've started seeing the following crash in my app:

Fatal Exception: java.lang.RuntimeException
Unable to create application com.doximity.doximitydroid.bases.DoxApp:
java.lang.RuntimeException: Using WebView from more than one process at once with the
same data directory is not supported. 
https://crbug.com/558377 : Current process com.doximity.doximitydroid (pid 9862),
lock owner com.doximity.doximitydroid (pid 8728)

It only happens in the background on Samsung Galaxy S21 devices running Android 12. My app currently targets Android 11 and it does not seem to be related to any changes in my app. I tested on a Samsung Galaxy S21 device but was not able to reproduce (seems like its only a subset of users).

Reading up on the specific crash, it appears to be due to multiple processes in our app being created and attempting to write to the default data directory for the WebView. Again, this popped up out of nowhere and is only happening to a very specific subset of users, so I'm not certain it's an issue with my app.

Hoping someone might have some insight on this issue.

I did find this SO post discussing a similar issue but I never saw on Android 11 and unfortunately it looks like no resolution was ever reached by the author.

Rabbinical answered 10/12, 2021 at 23:39 Comment(3)
FWIW, I've been seeing the same thing. Other than possibly something tied to Samsung DeX, I am at a loss as to what is going on. AFAICT, though, it's not a bug in our apps.Mikol
Out of curiosity, have you tried calling WebView.setDataDirectorySuffix after detecting when you're not in the main process in application class or something? Maybe some library or something is creating a different process and that can cause the WebView to crash the app, or it could be possible that webviews are running on a different process altogether since there is an option to enable it from Developer Options. These are just assumptions, though.Kamilah
2 things come to mind: Check the final merged manifest on the release build of the app through app/build/intermediates/merged_manifest/release/AndroidManifest.xml and see if any component has the attribute android:process. If none are present, creating a different process usually means the Application class to be called. You can use Application.getProcessName() to retrieve the process name (you only need it for API 28 and above) and then report it somewhere to see the results.Kamilah

© 2022 - 2024 — McMap. All rights reserved.