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

fdsan: attempted to close file descriptor 0 #26

Closed
qamarkhan1 opened this issue Dec 23, 2024 · 13 comments
Closed

fdsan: attempted to close file descriptor 0 #26

qamarkhan1 opened this issue Dec 23, 2024 · 13 comments
Assignees
Labels
flutter Related to Flutter library question Further information is requested

Comments

@qamarkhan1
Copy link

it says to me
"Device permission is not granted" and then app is crashed! , on an other phone, it is not crashed nor this message is shown, but streaming does not start

I have requested all perms in manifest ,

like given below, and Camera and Microphone is already granted

@alexey-pelykh
Copy link
Owner

Does the unaltered example app work on your devices? You can try installing it from this archive: https://github.com/alexey-pelykh/UVCCamera/actions/runs/12465875213/artifacts/2355594257

@alexey-pelykh alexey-pelykh added question Further information is requested flutter Related to Flutter library labels Dec 23, 2024
@alexey-pelykh
Copy link
Owner

If the example crashes for you - a crash log would be helpful. If the example does not crash for you - I'd suggest checking if you've integrated the library into your application as shown in the example

@qamarkhan1
Copy link
Author

qamarkhan1 commented Dec 24, 2024

I was able to ran it from last day, now got this error, this happens sometimes

Here are logs

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'OPPO/CPH2285/OP4F43L1:13/TP1A.220905.001/R.1af71a4+49f9:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-12-24 15:09:15.501308689+0500
Process uptime: 430s
Cmdline: com.example.wired_streaming_2
pid: 25381, tid: 25381, name: red_streaming_2  >>> com.example.wired_streaming_2 <<<
uid: 10937
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'fdsan: attempted to close file descriptor 0, expected to be unowned, actually owned by unique_fd 0x7bfe3a2d6c'
    x0  0000000000000000  x1  0000000000006325  x2  0000000000000006  x3  0000007fcd804b50
    x4  0000000000808080  x5  0000000000808080  x6  0000000000808080  x7  8080808080808080
    x8  00000000000000f0  x9  3debe8b004428b98  x10 fefefefefefefeff  x11 7f7f7f7f7f7f7f7f
    x12 0101010101010101  x13 000000fbd8dfe2f2  x14 00114a17eb15ef3d  x15 0000000000000030
    x16 0000007cba59a8e0  x17 0000007cba5742f0  x18 0000007cded12000  x19 0000000000006325
    x20 0000000000006325  x21 0000007cde010000  x22 0000000000000003  x23 0000007fcd804948
    x24 0000007fcd804c40  x25 0000007fcd8048c0  x26 0000007fcd804880  x27 ffffff80ffffffc8
    x28 0000007fcd804d00  x29 0000007fcd804be0
    lr  0000007cba51ffbc  sp  0000007fcd804800  pc  0000007cba51ffe0  pst 0000000000000000
backtrace:
      #00 pc 0000000000080fe0  /apex/com.android.runtime/lib64/bionic/libc.so (fdsan_error(char const*, ...)+448) (BuildId: cd953571180b7f5f8ae5570dad29595f)
      #01 pc 0000000000080d4c  /apex/com.android.runtime/lib64/bionic/libc.so (android_fdsan_close_with_tag+732) (BuildId: cd953571180b7f5f8ae5570dad29595f)
      #02 pc 0000000000081460  /apex/com.android.runtime/lib64/bionic/libc.so (close+16) (BuildId: cd953571180b7f5f8ae5570dad29595f)
      #03 pc 000000000001105c  /data/app/~~qJ9m-8Dn2GwBPNqK10pzHQ==/com.example.wired_streaming_2-1Ltxj6rWoFhoU-R-FHNCIg==/lib/arm64/libUVCCamera.so (UVCCamera::release()+168) (BuildId: e1b4bf0daa9fd0385995ace734940e3f515008e9)
      #04 pc 0000000000383d70  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #05 pc 000000000036d840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #06 pc 0000000000366af8  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2048) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #07 pc 000000000076e870  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+12208) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #08 pc 00000000003863d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #09 pc 00000000002fe550  [anon:dalvik-classes.dex extracted in memory from /data/app/~~qJ9m-8Dn2GwBPNqK10pzHQ==/com.example.wired_streaming_2-1Ltxj6rWoFhoU-R-FHNCIg==/base.apk] (com.serenegiant.usb.UVCCamera.close+0)
      #10 pc 0000000000358eec  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.17771861963221910393)+428) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #11 pc 0000000000367314  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+4124) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #12 pc 000000000076e870  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+12208) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #13 pc 00000000003863d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #14 pc 00000000002fe5c4  [anon:dalvik-classes.dex extracted in memory from /data/app/~~qJ9m-8Dn2GwBPNqK10pzHQ==/com.example.wired_streaming_2-1Ltxj6rWoFhoU-R-FHNCIg==/base.apk] (com.serenegiant.usb.UVCCamera.destroy+0)
      #15 pc 0000000000358278  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1932) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #16 pc 0000000000383e98  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #17 pc 00000000024a6898  /memfd:jit-cache (deleted) (org.uvccamera.flutter.UvcCameraPlatform.openCamera+760)
      #18 pc 00000000024a2cd0  /memfd:jit-cache (deleted) (org.uvccamera.flutter.UvcCameraNativeMethodCallHandler.onMethodCall+12160)
      #19 pc 00000000024af7c0  /memfd:jit-cache (deleted) (io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage+304)
      #20 pc 00000000024b13cc  /memfd:jit-cache (deleted) (io.flutter.embedding.engine.dart.DartMessenger.invokeHandler+316)
      #21 pc 0000000002494400  /memfd:jit-cache (deleted) (io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger+496)
      #22 pc 00000000024af5ac  /memfd:jit-cache (deleted) (io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run+204)
      #23 pc 000000000236e72c  /memfd:jit-cache (deleted) (android.os.Handler.handleCallback+140)
      #24 pc 00000000020c4ba8  /memfd:jit-cache (deleted) (android.os.Handler.dispatchMessage+136)
      #25 pc 000000000209bb4c  /memfd:jit-cache (deleted) (android.os.Looper.loopOnce+1372)
      #26 pc 000000000036d840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #27 pc 0000000000366af8  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2048) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #28 pc 000000000076e870  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+12208) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #29 pc 00000000003863d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #30 pc 00000000001f0fd8  /system/framework/framework.jar (android.os.Looper.loop+0)
      #31 pc 0000000000358eec  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238.llvm.17771861963221910393)+428) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #32 pc 0000000000367314  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+4124) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #33 pc 000000000076e870  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+12208) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #34 pc 00000000003863d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #35 pc 00000000001c8114  /system/framework/framework.jar (android.app.ActivityThread.main+0)
      #36 pc 0000000000358278  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1932) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #37 pc 0000000000383e98  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #38 pc 000000000036d840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #39 pc 0000000000369190  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+732) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #40 pc 00000000006c9134  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #41 pc 0000000000383d70  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #42 pc 000000000036d574  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #43 pc 0000000000366a80  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+1928) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #44 pc 000000000076e870  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+12208) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #45 pc 00000000003863d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #46 pc 0000000000412da4  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+0)
      #47 pc 0000000000358278  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1932) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #48 pc 0000000000383e98  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #49 pc 0000000000f7ffa8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+4440)
      #50 pc 000000000036d840  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #51 pc 0000000000358c08  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+204) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)
      #52 pc 0000000000356bbc  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+512) (BuildId: c35c9ebf7bb06435e4b31977d87bd5d5)

@alexey-pelykh
Copy link
Owner

Thanks for the logs! I'll be able to work on the fix now

@alexey-pelykh
Copy link
Owner

Does the same issue happen to you using the original unmodified example?

@alexey-pelykh alexey-pelykh changed the title Device permission is not granted fdsan: attempted to close file descriptor 0 Dec 24, 2024
@qamarkhan1
Copy link
Author

Actually, I'm unable to test your shared apk on my device, as apks build in flutter 3.27. shows only blank black page on my device, and only works if I build with "flutter run --no-enable-impeller"

@alexey-pelykh
Copy link
Owner

alexey-pelykh commented Dec 24, 2024

🤔 We definitely need to isolate that within an example app. What device are you using? Oppo F19?

@qamarkhan1
Copy link
Author

yes, Oppo F19 pro

@qamarkhan1
Copy link
Author

I installed now your shared apk on another device (Infinix X6525), it crashes instantly whenever I tap on available usb camera, but on Oppo F19 Pro, it works fine when I myself build project with "flutter run --no-enable-impeller" and crashes only if I disconnect and reconnect usb camera

@alexey-pelykh
Copy link
Owner

alexey-pelykh commented Dec 25, 2024

Could you please repeat the tests with most recent https://github.com/alexey-pelykh/UVCCamera/actions/runs/12486753231/artifacts/2360287621 and capture logs of the crashes. I'm researching into the impeller issue meanwhile

@alexey-pelykh
Copy link
Owner

@qamarkhan1
Copy link
Author

for Oppo F19, I can say it is working fine if I run with

but for Infinix X6525, your above apk crashed and my code with 0.0.8, available latest package version it crashes

D/UvcCameraPlatform(12842): UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=250,mInterfaces=[
D/UvcCameraPlatform(12842): UsbInterface[mId=0,mAlternateSetting=0,mName=USB Video,mClass=14,mSubclass=1,mProtocol=0,mEndpoints=[]
D/UvcCameraPlatform(12842): UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[]
D/UvcCameraPlatform(12842): UsbInterface[mId=1,mAlternateSetting=1,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[
D/UvcCameraPlatform(12842): UsbEndpoint[mAddress=131,mAttributes=5,mMaxPacketSize=800,mInterval=1]]
D/UvcCameraPlatform(12842): UsbInterface[mId=1,mAlternateSetting=2,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[
D/UvcCameraPlatform(12842): UsbEndpoint[mAddress=131,mAttributes=5,mMaxPacketSize=3072,mInterval=1]]
D/UvcCameraPlatform(12842): UsbInterface[mId=1,mAlternateSetting=3,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[
D/UvcCameraPlatform(12842): UsbEndpoint[mAddress=131,mAttributes=5,mMaxPacketSize=5120,mInterval=1]]
D/UvcCameraPlatform(12842): UsbInterface[mId=2,mAlternateSetting=0,mName=USB Digital Audio,mClass=1,mSubclass=1,mProtocol=0,mEndpoints=[]
D/UvcCameraPlatform(12842): UsbInterface[mId=3,mAlternateSetting=0,mName=USB Digital Audio,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[]
D/UvcCameraPlatform(12842): UsbInterface[mId=3,mAlternateSetting=1,mName=USB Digital Audio,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[
D/UvcCameraPlatform(12842): UsbEndpoint[mAddress=130,mAttributes=5,mMaxPacketSize=256,mInterval=4]]
D/UvcCameraPlatform(12842): UsbInterface[mId=4,mAlternateSetting=0,mName=null,mClass=3,mSubclass=0,mProtocol=0,mEndpoints=[
D/UvcCameraPlatform(12842): UsbEndpoint[mAddress=132,mAttributes=3,mMaxPacketSize=4,mInterval=16]]]]
E/AndroidRuntime(12842): FATAL EXCEPTION: USBMonitor
E/AndroidRuntime(12842): Process: com.example.wired_streaming_2, PID: 12842
E/AndroidRuntime(12842): java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] android.hardware.usb.UsbDeviceConnection.getRawDescriptors()' on a null object reference
E/AndroidRuntime(12842): at com.serenegiant.usb.USBMonitor.updateDeviceInfo(USBMonitor.java:921)
E/AndroidRuntime(12842): at com.serenegiant.usb.USBMonitor$UsbControlBlock.(USBMonitor.java:995)
E/AndroidRuntime(12842): at com.serenegiant.usb.USBMonitor$UsbControlBlock.(Unknown Source:0)
E/AndroidRuntime(12842): at com.serenegiant.usb.USBMonitor$3.run(USBMonitor.java:580)
E/AndroidRuntime(12842): at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime(12842): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(12842): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(12842): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(12842): at android.os.HandlerThread.run(HandlerThread.java:67)
I/Process (12842): Sending signal. PID: 12842 SIG: 9
Lost connection to device.

@alexey-pelykh
Copy link
Owner

Thanks for reporting back! As for the Impeller support, I'm going to track effort in #34 and this crash log as #35 closing this one as it seems that the original error seems to be gone.

@alexey-pelykh alexey-pelykh closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flutter Related to Flutter library question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants