facebook/SoLoader

java.io.FileNotFoundException: open failed: EACCES (Permission denied)

fansilva1991 opened this issue ยท 11 comments

Hello,

My application is crashing only when running on Android 5.X. Here are the details about the error:

Error Stacktrace:

FATAL EXCEPTION: main

Caused by: java.io.FileNotFoundException: /data/data/APP_ID/lib-main/dso_lock: open failed: EACCES (Permission denied)

FATAL EXCEPTION: main
Process: APP_ID:p54993bdf2c8b1ed6b7cda959, PID: 10210
java.lang.RuntimeException: Unable to create application APP_ID.MainApplication: java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/APP_ID/lib-main/dso_lock: open failed: EACCES (Permission denied)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556)
	at android.app.ActivityThread.access$1500(ActivityThread.java:151)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5254)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/APP_ID/lib-main/dso_lock: open failed: EACCES (Permission denied)
	at com.facebook.soloader.SoLoader.init(SoLoader.java:192)
	at APP_ID.MainApplication.onCreate(MainApplication.java:52)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
	... 9 more
Caused by: java.io.FileNotFoundException: /data/data/APP_ID/lib-main/dso_lock: open failed: EACCES (Permission denied)
	at libcore.io.IoBridge.open(IoBridge.java:456)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
	at com.facebook.soloader.FileLocker.<init>(FileLocker.java:35)
	at com.facebook.soloader.FileLocker.lock(FileLocker.java:31)
	at com.facebook.soloader.UnpackingSoSource.prepare(UnpackingSoSource.java:417)
	at com.facebook.soloader.SoLoader.initSoSources(SoLoader.java:304)
	at com.facebook.soloader.SoLoader.init(SoLoader.java:181)
	at com.facebook.soloader.SoLoader.init(SoLoader.java:164)
	at com.facebook.soloader.SoLoader.init(SoLoader.java:190)
	... 12 more
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
	at libcore.io.IoBridge.open(IoBridge.java:442)
	... 21 more

Enviroment:

System:
    OS: macOS 11.6.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 63.66 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.8.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.21.0 - /usr/local/bin/npm
    Watchman: 2021.08.23.00 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0
      System Images: android-22 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

Details

The error happens when opening the application, only on Android 5.X versions.

Already tried to add android:requestLegacyExternalStorage="true" to the AndroidManifest.xml, with no success.

which version are you using?

@simpleton sorry for the late response.

This is the version I'm using.

Screen Shot 2021-11-19 at 20 19 45

@simpleton this is the version used by React Native by default.

Do you know if we have a recommended version to upgrade? I can try to do this and check if solve this issue ( I'm only worried because it is the version chosen by react-native to be used ).

hi, we started receiving the very same issue. we are on com.facebook.soloader:soloader:0.10.3
Here the stacktrace from a Samsung Galaxy J4 Core Android 8.1.0:

Fatal Exception: java.lang.RuntimeException: java.io.FileNotFoundException: /data/user/0/com.careem.acma/lib-1/dso_state: open failed: EACCES (Permission denied)
       at com.facebook.soloader.SoLoader.init(SoLoader.java:257)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke$lambda-0(MMKVInitializer.java:20)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1$$InternalSyntheticLambda$0$05aca83d58dc9bd9fd24da9ab58627c0dc8f0d0e1259934b4dcaf664a3bfc8bc$0.loadLibrary(MMKVInitializer.java:14)
       at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:189)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:181)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:122)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:25)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:17)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer.init(MMKVInitializer.java:35)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVSharedPreferencesProvider$initJob$1.invokeSuspend(MMKVSharedPreferencesProvider.kt:18)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Caused by java.io.FileNotFoundException: /data/user/0/com.careem.acma/lib-1/dso_state: open failed: EACCES (Permission denied)
       at libcore.io.IoBridge.open(IoBridge.java:512)
       at java.io.RandomAccessFile.<init>(RandomAccessFile.java:274)
       at com.facebook.soloader.UnpackingSoSource.refreshLocked(UnpackingSoSource.java:372)
       at com.facebook.soloader.UnpackingSoSource.prepare(UnpackingSoSource.java:516)
       at com.facebook.soloader.SoLoader.initSoSources(SoLoader.java:306)
       at com.facebook.soloader.SoLoader.init(SoLoader.java:239)
       at com.facebook.soloader.SoLoader.init(SoLoader.java:255)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke$lambda-0(MMKVInitializer.java:20)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1$$InternalSyntheticLambda$0$05aca83d58dc9bd9fd24da9ab58627c0dc8f0d0e1259934b4dcaf664a3bfc8bc$0.loadLibrary(MMKVInitializer.java:10)
       at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:189)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:181)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:122)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:25)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:17)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer.init(MMKVInitializer.java:35)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVSharedPreferencesProvider$initJob$1.invokeSuspend(MMKVSharedPreferencesProvider.kt:18)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Caused by android.system.ErrnoException: open failed: EACCES (Permission denied)
       at libcore.io.Linux.open(Linux.java)
       at libcore.io.BlockGuardOs.open(BlockGuardOs.java:207)
       at libcore.io.IoBridge.open(IoBridge.java:498)
       at java.io.RandomAccessFile.<init>(RandomAccessFile.java:274)
       at com.facebook.soloader.UnpackingSoSource.refreshLocked(UnpackingSoSource.java:372)
       at com.facebook.soloader.UnpackingSoSource.prepare(UnpackingSoSource.java:516)
       at com.facebook.soloader.SoLoader.initSoSources(SoLoader.java:306)
       at com.facebook.soloader.SoLoader.init(SoLoader.java:239)
       at com.facebook.soloader.SoLoader.init(SoLoader.java:255)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke$lambda-0(MMKVInitializer.java:20)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1$$InternalSyntheticLambda$0$05aca83d58dc9bd9fd24da9ab58627c0dc8f0d0e1259934b4dcaf664a3bfc8bc$0.loadLibrary(MMKVInitializer.java:10)
       at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:189)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:181)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:122)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:25)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer$mmkv$1.invoke(MMKVInitializer.kt:17)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVInitializer.init(MMKVInitializer.java:35)
       at com.careem.superapp.core.persistence.sharedpreferences.MMKVSharedPreferencesProvider$initJob$1.invokeSuspend(MMKVSharedPreferencesProvider.kt:18)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Same is happening for us for SoLoader 0.10.3. We can't reproduce it locally, but Firebase reports numerous crashes on devices running Android 10-12

Also encountering this issue on SoLoader 0.10.3 in a production app. The overwhelming majority of our crashes are coming from Pixel devices, but there are a handful of Motorola and Samsung as well. All are on SDK 31 or SDK 32 (Android 12). If anyone has steps to re-create this, that would be great.

Have not been able to re-create it yet, so the only info I have is from Android Vitals on Google Play

java.io.FileNotFoundException
com.facebook.soloader.UnpackingSoSource.refreshLocked
java.lang.RuntimeException: 
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6730)
  at android.app.ActivityThread.access$1500 (ActivityThread.java:247)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2053)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7839)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by: java.lang.RuntimeException: 
  at com.facebook.soloader.SoLoader.init (SoLoader.java:257)
  at com.tactacam.reveal.MainApplication.onCreate (MainApplication.java:71)
  at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1211)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6725)
Caused by: java.io.FileNotFoundException: 
  at libcore.io.IoBridge.open (IoBridge.java:575)
  at java.io.RandomAccessFile.<init> (RandomAccessFile.java:289)
  at com.facebook.soloader.UnpackingSoSource.refreshLocked (UnpackingSoSource.java:372)
  at com.facebook.soloader.UnpackingSoSource.prepare (UnpackingSoSource.java:516)
  at com.facebook.soloader.SoLoader.initSoSources (SoLoader.java:306)
  at com.facebook.soloader.SoLoader.init (SoLoader.java:239)
  at com.facebook.soloader.SoLoader.init (SoLoader.java:255)
Caused by: android.system.ErrnoException: 
  at libcore.io.Linux.open (Native Method)
  at libcore.io.ForwardingOs.open (ForwardingOs.java:567)
  at libcore.io.BlockGuardOs.open (BlockGuardOs.java:273)
  at libcore.io.ForwardingOs.open (ForwardingOs.java:567)
  at android.app.ActivityThread$AndroidOs.open (ActivityThread.java:7725)
  at libcore.io.IoBridge.open (IoBridge.java:561)

should be fixed in b28033f

duplicate #100