Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Exception: java.io.FileNotFoundException: open failed: EACCES (Permission denied) #6611

Open
Ihor-SA opened this issue Jan 2, 2025 · 3 comments

Comments

@Ihor-SA
Copy link

Ihor-SA commented Jan 2, 2025

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Ladybug | 2024.2.1 Patch 3
  • Firebase Component: Crashlytics, Crashlytics-ndk
  • Component version: com.google.firebase:firebase-bom:33.1.1

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Fatal Exception: java.io.FileNotFoundException: /data/user/0/<PACKAGE_NAME>/files/datastore/firebase_session_Y29tLnNlZWtpbmdhbHBoYS53ZWJ3cmFwcGVyOnRhYjI3_settings.preferences_pb: open failed: EACCES (Permission denied)
       at libcore.io.IoBridge.open(IoBridge.java:575)
       at java.io.FileInputStream.<init>(FileInputStream.java:160)
       at okio.Okio__JvmOkioKt.source(Okio__JvmOkio.kt:181)
       at okio.Okio.source(Okio.java:1)
       at okio.JvmSystemFileSystem.source(JvmSystemFileSystem.kt:96)
       at androidx.datastore.core.okio.OkioReadScope.readData$suspendImpl(OkioStorage.kt:227)
       at androidx.datastore.core.okio.OkioReadScope.readData(OkioReadScope.java:104)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invokeSuspend(StorageConnection.kt:74)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invoke(StorageConnection.kt:47)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invoke(StorageConnection.kt:47)
       at androidx.datastore.core.okio.OkioStorageConnection.readScope(OkioStorage.kt:113)
       at androidx.datastore.core.StorageConnectionKt.readData(StorageConnection.kt:74)
       at androidx.datastore.core.DataStoreImpl.readDataFromFileOrDefault(DataStoreImpl.kt:331)
       at androidx.datastore.core.DataStoreImpl.readDataOrHandleCorruption(DataStoreImpl.kt:373)
       at androidx.datastore.core.DataStoreImpl.access$readDataOrHandleCorruption(DataStoreImpl.kt:53)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invokeSuspend(DataStoreImpl.kt:445)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invoke(DataStoreImpl.kt:11)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invoke(DataStoreImpl.kt:11)
       at androidx.datastore.core.SingleProcessCoordinator.lock(SingleProcessCoordinator.kt:41)
       at androidx.datastore.core.DataStoreImpl$InitDataStore.doRun(DataStoreImpl.kt:442)
       at androidx.datastore.core.RunOnce.runIfNeeded(DataStoreImpl.kt:505)
       at androidx.datastore.core.DataStoreImpl.readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:274)
       at androidx.datastore.core.DataStoreImpl.access$readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:53)
       at androidx.datastore.core.DataStoreImpl$readState$2.invokeSuspend(DataStoreImpl.kt:226)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:111)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:584)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
Caused by android.system.ErrnoException: open failed: EACCES (Permission denied)
       at libcore.io.Linux.open(Linux.java)
       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:8523)
       at libcore.io.IoBridge.open(IoBridge.java:561)
       at java.io.FileInputStream.<init>(FileInputStream.java:160)
       at okio.Okio__JvmOkioKt.source(Okio__JvmOkio.kt:181)
       at okio.Okio.source(Okio.java:1)
       at okio.JvmSystemFileSystem.source(JvmSystemFileSystem.kt:96)
       at androidx.datastore.core.okio.OkioReadScope.readData$suspendImpl(OkioStorage.kt:227)
       at androidx.datastore.core.okio.OkioReadScope.readData(OkioReadScope.java:104)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invokeSuspend(StorageConnection.kt:74)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invoke(StorageConnection.kt:47)
       at androidx.datastore.core.StorageConnectionKt$readData$2.invoke(StorageConnection.kt:47)
       at androidx.datastore.core.okio.OkioStorageConnection.readScope(OkioStorage.kt:113)
       at androidx.datastore.core.StorageConnectionKt.readData(StorageConnection.kt:74)
       at androidx.datastore.core.DataStoreImpl.readDataFromFileOrDefault(DataStoreImpl.kt:331)
       at androidx.datastore.core.DataStoreImpl.readDataOrHandleCorruption(DataStoreImpl.kt:373)
       at androidx.datastore.core.DataStoreImpl.access$readDataOrHandleCorruption(DataStoreImpl.kt:53)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invokeSuspend(DataStoreImpl.kt:445)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invoke(DataStoreImpl.kt:11)
       at androidx.datastore.core.DataStoreImpl$InitDataStore$doRun$initData$1.invoke(DataStoreImpl.kt:11)
       at androidx.datastore.core.SingleProcessCoordinator.lock(SingleProcessCoordinator.kt:41)
       at androidx.datastore.core.DataStoreImpl$InitDataStore.doRun(DataStoreImpl.kt:442)
       at androidx.datastore.core.RunOnce.runIfNeeded(DataStoreImpl.kt:505)
       at androidx.datastore.core.DataStoreImpl.readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:274)
       at androidx.datastore.core.DataStoreImpl.access$readAndInitOrPropagateAndThrowFailure(DataStoreImpl.kt:53)
       at androidx.datastore.core.DataStoreImpl$readState$2.invokeSuspend(DataStoreImpl.kt:226)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:111)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:584)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

Relevant Code:

No specific code.
@lehcar09
Copy link
Contributor

lehcar09 commented Jan 3, 2025

Hi @Ihor-SA, thank you for reaching out. I tried reproducing the issue, however, I did not not encounter the same error.

Based on the logs you shared, it looks to me that this is not an SDK issue. Could you share the Android Gradle Plugin version you're using? Also, can you share an MCVE to help us investigate the issue further?

In addition to that, I noticed that you're not using the latest SDK version. Could you try using the latest Firebase SDK version? This is to ensure that you have that latest bug fixes that might be causing the issue. Thanks!

@Ihor-SA
Copy link
Author

Ihor-SA commented Jan 7, 2025

@lehcar09 thank you for your response. We are currently using Gradle version 8.2.2. Unfortunately, I’m unable to reproduce the issue either, as the report comes from Crashlytics. However, the problem seems to occur on Android versions 10 and above (API level 29+). Our minimum API level is 24, target and compile version is 34, and we’ve set android:installLocation="auto" in the AndroidManifest file.
Image

@lehcar09
Copy link
Contributor

lehcar09 commented Jan 9, 2025

Thank you for the details @Ihor-SA. From what I gather, this issue is from Firebase dependency androidx.datastore (issuetracker/337870543). It looks like this issue is caused by a race condition where the DataStore file might not exist yet when the read operation begins.

According to this comment:

Sorry for the delay in responding to this issue, as we've seen similar issues in the other bugs and followed up there. This is hard for us to debug as it seems to be a race condition and we cannot easily reproduce it and understand the root cause. Please help us by providing more details (device populations, API levels, or anything you discover as relevant to the bug distribution) from your observation of its occurrence! Also a sample app to reproduce would be great if possible.

In the meantime, I'll try to do some more investigation with the given information. Thanks for your patience.

I'll keep this open for now so that we can keep an eye on it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants