Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

fdsan fails on closing SAF file descriptor at the end #634

Closed
alexcohn opened this issue Dec 28, 2020 · 4 comments
Closed

fdsan fails on closing SAF file descriptor at the end #634

alexcohn opened this issue Dec 28, 2020 · 4 comments
Assignees
Labels
incompatibility wontfix This will not be worked on

Comments

@alexcohn
Copy link
Contributor

Description
This is the ffprobe command executed:

[-print_format, json=c=1, -show_chapters, -loglevel, quiet, -show_entries, format=duration, -show_entries, format_tags=artist,title,album, -show_entries, stream_tags=artist,title,album, -select_streams, a, -i, saf:69/28 - Kapitel 8_ Mondmänner und Katzonauten.mp3]

And this is the sigabrt crash:

A/libc: fdsan: attempted to close file descriptor 69, expected to be unowned, actually owned by ParcelFileDescriptor 0xcd37e73
A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 14414 (DefaultDispatch), pid 14385 (audiobook.debug)
Tested targeting android 11 using a pixel 4.

Expected behavior
fdsan should allow the SAF descriptor to be closed

Current behavior
fdsan considers the SAF descriptor as owned by ParcelFileDescriptor

Environment

  • Platform: Android
  • Architecture: arm64-v8a
  • Version 4.4
  • Source branch development
  • Android Studio version 4.1
  • Android NDK version 21.1

Other
Confirmed on emulator.

@tanersener
Copy link
Owner

These two pages, File descriptor sanitizer (fdsan) and fdsan explain what has changed in Android 11 (API Level 30) and what must be done to fix this.

Unfortunately, they recommend to use fdsan to close the native fds. But the problem is, fdsan is only available on API Level 29 >=. So, using fdsan directly is not possible. Any suggestions?

@tanersener
Copy link
Owner

Apparently, ParcelFileDescriptor.close() method that we call inside Config.closeParcelFileDescriptor is already closing the fd. If we close the fd again fdsan complains that we're double-closing it. So, I'll remove the close from the native method to fix this.

E/fdsan: double-close of file descriptor 64 detected

@tanersener tanersener self-assigned this Jan 25, 2021
alexcohn added a commit to alexcohn/mobile-ffmpeg that referenced this issue Mar 6, 2021
attempted to close file descriptor XX, expected to be unowned, actually owned by ParcelFileDescriptor XXX
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@tanersener tanersener added the wontfix This will not be worked on label Apr 13, 2021
@tanersener
Copy link
Owner

This project will be retired. Please consider switching to FFmpegKit. This issue is fixed there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
incompatibility wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants