Failed to create lock file webview_data.lock

3.3k Views Asked by At

We are facing an exception that I have no idea how to resolve to. It seems to be related to webviews and multi processing and our app does use up to 4 processes. However I would expect this crash on Android 9 because multiprocessing requires webviews to call WebView.setDataDirectorySuffix(suffix) and we are already calling it. Frankly, Android 9 and 10 seems to be fine out of 70 crashes so far.

I would not expect this crash on other versions, though it happens on Android 5.0, 5.1 and 6.0 only. Application is proguarded but the mapping file is uploaded to Crashlytics so I expected a better stack trace but this is only I have. I don't know why this happens, I wasn't able to produce this locally with our Android 5 and 6 devices, or emulator. It only happens on production but frequently.

The application uses Firebase Analytics, Google Ads with various mediations and in app billing if that helps. And, we've recently added something called Yandex Metrica which runs in its own process with the suffix ":Metrica". My guess is that it comes from there because the code in Metrica uses the component "java.nio.FileLock" and tries to acquire a lock. At least, that's what I've found by decompiling our APK and searching for that package.

Edit

This may be wrong because apparently another app of ours throw the same exception without using Yandex Metrica.

Stack trace:

Fatal Exception: java.lang.RuntimeException: Failed to create lock file /data/user/0/com.example.app/app_webview/webview_data.lock
       at org.chromium.android_webview.AwDataDirLock.a + 22(AwDataDirLock.java:22)
       at F8.g + 46(F8.java:46)
       at E8.run + 2(E8.java:2)
       at Kw.f + 11(Kw.java:11)
       at Jw.run(Jw.java)
       at android.os.Handler.handleCallback + 743(Handler.java:743)
       at android.os.Handler.dispatchMessage + 95(Handler.java:95)
       at android.os.Looper.loop + 171(Looper.java:171)
       at android.app.ActivityThread.main + 5417(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 726(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main + 616(ZygoteInit.java:616)

Gradle dependencies:

implementation fileTree(dir: 'libs', include: '*.aar')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation "androidx.preference:preference:1.1.0"
implementation 'com.android.support:percent:28.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha02'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.github.GrenderG:Toasty:1.3.0'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.anrwatchdog:anrwatchdog:1.4.0'
implementation 'com.airbnb.android:lottie:3.0.7'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

implementation ("com.google.firebase:firebase-ads:17.1.0") {
    exclude group: 'com.android.support'
}
implementation ('com.google.firebase:firebase-messaging:17.3.4') {
    exclude group: 'com.android.support'
}
implementation "com.google.firebase:firebase-crash:16.2.1"
implementation('com.labo.kaji:swipeawaydialog:0.1.1') {
    transitive = true
    exclude group: 'com.android.support'
}
implementation 'com.github.zurche:plain-pie:v0.1.1'

implementation 'com.google.firebase:firebase-config:19.1.1'

// Yandex API Metrica implementation.
implementation 'com.yandex.android:mobmetricalib:3.10.0'

// Ads

implementation 'com.google.android.material:material:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'

implementation 'com.google.ads.mediation:applovin:9.8.0.0'
implementation 'com.google.ads.mediation:facebook:5.6.0.0'
implementation 'com.mopub.volley:mopub-volley:2.1.0'
implementation('com.mopub:mopub-sdk:5.7.0@aar') {
    transitive = true
    exclude module: 'libAvid-mopub' // To exclude AVID
    exclude module: 'moat-mobile-app-kit' // To exclude Moat
}
implementation 'com.google.ads.mediation:mopub:5.7.0.0'
implementation 'com.google.ads.mediation:inmobi:7.3.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'com.google.ads.mediation:tapjoy:12.3.1.0'
implementation 'com.unity3d.ads:unity-ads:3.1.0'
implementation 'com.google.ads.mediation:unity:3.1.0.0'

// Crashlytics implementation.
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
    transitive = true
}

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.preference:preference:1.1.0"
implementation ("com.kochava.base:tracker:3.5.0") {
    exclude group: "com.android.support"
}
implementation "androidx.work:work-runtime:2.3.1"

// Required: Install Referrer (If publishing to Google Play)
// noinspection GradleDependency
implementation 'com.android.installreferrer:installreferrer:1.1'

// Required: To track down latest updates
implementation 'com.google.android.play:core:1.6.4'

// Required: To track down notifications.
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'

implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-analytics-impl:17.0.0'

// Optional: Instant App Status Collection
implementation 'com.google.android.instantapps:instantapps:1.1.0'

// Required for Flurry Analytics integration
implementation 'com.flurry.android:analytics:11.4.0@aar'

// Crashlytics implementation.
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
    transitive = true
}

// Multidex implementation.
implementation 'androidx.multidex:multidex:2.0.1'

implementation 'com.android.billingclient:billing:2.1.0'

// Don't update these libraries. They cause below API 21 to crash.
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'

implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.romainpiel.shimmer:library:1.4.0@aar'

Any help is appreciated, thanks.

0

There are 0 best solutions below