fdsan: failed to exchange ownership of file descriptor
Closed this issue · 13 comments
Integration
sentry-android
Build System
Gradle
AGP Version
7.4.0
Proguard
Disabled
Version
4.14.1
Steps to Reproduce
Found this on Google Play Console
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 31064 >>> com.example.app <<<
backtrace:
#00 pc 0x000000000009988c /apex/com.android.runtime/lib64/bionic/libc.so (fdsan_error(char const*, ...)+564)
#01 pc 0x0000000000097128 /apex/com.android.runtime/lib64/bionic/libc.so (opendir+84)
#02 pc 0x0000000000026f6c /apex/com.android.art/lib64/libopenjdk.so (Java_java_io_UnixFileSystem_list0+112)
#03 pc 0x0000000000332ffc /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+124)
#04 pc 0x0000000000400700 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.io.UnixFileSystem.list+240)
#05 pc 0x00000000003f30ec /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.io.File.list+220)
#06 pc 0x00000000003f3388 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.io.File.listFiles+56)
#07 pc 0x0000000000c8d9ec /data/app/~~urDmxS9flCge40B4Ygg3kw==/com.example.app--DiOV9oEQY2KS6SFfk47Qw==/oat/arm64/base.odex (io.sentry.DirectoryProcessor.processDirectory+620)
#08 pc 0x0000000000ccab5c /data/app/~~urDmxS9flCge40B4Ygg3kw==/com.example.app--DiOV9oEQY2KS6SFfk47Qw==/oat/arm64/base.odex ([DEDUPED] ?.processDirectory+44)
#09 pc 0x0000000000cd2e2c /data/app/~~urDmxS9flCge40B4Ygg3kw==/com.example.app--DiOV9oEQY2KS6SFfk47Qw==/oat/arm64/base.odex (io.sentry.SendCachedEnvelopeFireAndForgetIntegration$SendFireAndForgetFactory$$ExternalSyntheticLambda0.send+204)
#10 pc 0x0000000000cdfbb4 /data/app/~~urDmxS9flCge40B4Ygg3kw==/com.example.app--DiOV9oEQY2KS6SFfk47Qw==/oat/arm64/base.odex (io.sentry.android.core.SendCachedEnvelopeIntegration.lambda$sendCachedEnvelopes$0$io-sentry-android-core-SendCachedEnvelopeIntegration+884)
#11 pc 0x0000000000ca9390 /data/app/~~urDmxS9flCge40B4Ygg3kw==/com.example.app--DiOV9oEQY2KS6SFfk47Qw==/oat/arm64/base.odex (io.sentry.android.core.SendCachedEnvelopeIntegration$$ExternalSyntheticLambda0.run+64)
#12 pc 0x000000000045decc /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.concurrent.Executors$RunnableAdapter.call+60)
#13 pc 0x00000000004ebce4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.concurrent.FutureTask.run+164)
#14 pc 0x000000000056ad00 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run+128)
#15 pc 0x00000000005356a4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.concurrent.ThreadPoolExecutor.runWorker+724)
#16 pc 0x0000000000532fd8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.util.concurrent.ThreadPoolExecutor$Worker.run+56)
#17 pc 0x000000000040dc10 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.Thread.run+64)
#18 pc 0x0000000000368774 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612)
#19 pc 0x0000000000353f04 /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+132)
#20 pc 0x0000000000947a48 /apex/com.android.art/lib64/libart.so (art::detail::ShortyTraits<(char)86>::Type art::ArtMethod::InvokeInstance<(char)86>(art::Thread*, art::ObjPtr<art::mirror::Object>, art::detail::ShortyTraits<>::Type...)+60)
#21 pc 0x000000000061afcc /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1344)
#22 pc 0x000000000061aa7c /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallbackWithUffdGc(void*)+8)
#23 pc 0x00000000000fd254 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
#24 pc 0x0000000000096a04 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68)
build.gradle
plugins {
...
id "io.sentry.android.gradle" version "4.14.1"
Device: samsung dm2q (Galaxy S23+)
Android version: 14 (SDK34)
Expected Result
No crash
Actual Result
Crashed
Hi @kainjinez and thanks for the report!
Do you happen to have a full log with the name of the file throwing the error?
The logs you posted point to the DirectoryProcessor
The issue may be related to Android 11 fdsan behaviour change, but I cannot recall any report like this.
Maybe the system deleted a file in the cache while we tried to read it?
Hi @stefanosiano that's a full log I got from Google Play Console.
@kainjinez can you reproduce this issue locally? Or is it something you can only see in the Google Play Console? How often does it occur?
@markushi No. I cannot reproduce this. Only can see via Play Console.
The below records are yesterday.
Affected users: 8
Events: 12
Last occurred: 11 hours ago
Android 14: 4
Android 15: 4
4 Google devices
1 Motorolla device
3 Samsung devices
100% happen on foreground.
@kainjinez thanks for letting us know! This is definitely odd, as our SDK only retrieves a list of files using plain Java APIs. Is your Android app multi-process enabled by any chance?
Hi @markushi I don't define any process= in our AndroidManifest.xml.
If you need any information to track this. Please let me know.
@kainjinez does your app run in a special environment? e.g. work profiles.
@kainjinez do you have our NDK integration enabled? If so, is this error also visible in Sentry?
@stefanosiano Hi no. I don't use NDK library. I only add 1 line in plugins block.
@kainjinez do you use Sentry SaaS or self-hosted? If it's SaaS could you share a link to your sentry project here or send it to me roman@sentry.io? Thank you!
@kainjinez we're not able to reproduce this and we didn't receive other reports of it - can you provide a reproducer? EDIT: I just saw that you cannot reproduce it.
This seems to be an isolated issue since we have no other reports. In the current state this is not actionable for us, so I'm going to close the issue. If you have more information please leave a comment and we'll reopen.