Skip to content

rmtree stops when failing to remove a FIFO on device #518

Closed
@eunikolsky

Description

@eunikolsky

This is an issue when an iOS application uses Realm because it always creates a FIFO for every database, e.g. default.realm.management/lock.fifo for default.realm.

Expected behavior

ios-deploy -1 bundle_id --rmtree / should ignore FIFO removal errors and continue with removing other files.

Actual behavior

The command stops when it fails to remove a FIFO:

$ ios-deploy -v -1 io.realm.Simple --rmtree /
[....] Waiting for iOS device to be connected
Handling device type: 1
Already found device? 0
Hardware Model: J72bAP
Device Name: iPad
Model Name: iPad (2018)
SDK Name: iphoneos
Architecture Name: arm64
Product Version: 14.4.1
Build Version: 18D61
[....] Using X (J72bAP, iPad (2018), iphoneos, arm64, 14.4.1, 18D61) a.k.a. 'iPad'.
Deleting /Documents/default.realm.management/lock.fifo
2021-06-07 10:31:48.362 ios-deploy[22960:202158] [ !! ] Error 0xc: unknown. AFCRemovePath(conn, name)

Steps to reproduce the problem

I'm using the Simple example project here, but it can be reproduced with any iOS application with Realm:

  1. git clone https://github.com/realm/realm-cocoa.git
  2. cd realm-cocoa
  3. sh build.sh download-core to download necessary files.
  4. open examples/ios/swift/RealmExamples.xcworkspace to open the project, select the "Simple" target, run on your iOS device (you'll only see some logs in the console), stop the program. At this point, you'll see these files in the app container:
$ ios-deploy -1 io.realm.Simple --list
[....] Waiting for iOS device to be connected
[....] Using X (J72bAP, iPad (2018), iphoneos, arm64, 14.4.1, 18D61) a.k.a. 'iPad'.
//
/Documents/
/Documents/default.realm.management/
/Documents/default.realm.management/lock.fifo
/Documents/default.realm.management/access_control.write.mx.fifo
/Documents/default.realm.management/access_control.new_commit.cv
/Documents/default.realm.management/access_control.write.mx
/Documents/default.realm.management/access_control.control.mx
/Documents/default.realm.management/access_control.pick_writer.cv
/Documents/default.realm.management/access_control.control.mx.fifo
/Documents/default.realm
/Documents/default.realm.lock
/Documents/default.realm.note
<…skip…>
  1. Remove the files from the container (e.g. when you want to upload another container): ios-deploy -v -1 io.realm.Simple --rmtree /. See the result in "Actual behavior" above.

Notes

It's interesting that when downloading this container, ios-deploy reports the errors but continues anyway:

$ ios-deploy -v -1 io.realm.Simple --download --to=$HOME/Desktop/simple
[....] Waiting for iOS device to be connected
Handling device type: 1
Already found device? 0
Hardware Model: J72bAP
Device Name: iPadw
Model Name: iPad (2018)
SDK Name: iphoneos
Architecture Name: arm64
Product Version: 14.4.1
Build Version: 18D61
[....] Using X (J72bAP, iPad (2018), iphoneos, arm64, 14.4.1, 18D61) a.k.a. 'iPad'.
/Documents/
/Documents/default.realm.management/
/Documents/default.realm.management/lock.fifo
AFCFileRefOpen("/Documents/default.realm.management/lock.fifo") failed: 10
/Documents/default.realm.management/access_control.write.mx.fifo
AFCFileRefOpen("/Documents/default.realm.management/access_control.write.mx.fifo") failed: 10
/Documents/default.realm.management/access_control.new_commit.cv
AFCFileRefOpen("/Documents/default.realm.management/access_control.new_commit.cv") failed: 10
/Documents/default.realm.management/access_control.write.mx
/Documents/default.realm.management/access_control.control.mx
/Documents/default.realm.management/access_control.pick_writer.cv
AFCFileRefOpen("/Documents/default.realm.management/access_control.pick_writer.cv") failed: 10
/Documents/default.realm.management/access_control.control.mx.fifo
AFCFileRefOpen("/Documents/default.realm.management/access_control.control.mx.fifo") failed: 10
/Documents/default.realm
/Documents/default.realm.lock
/Documents/default.realm.note
AFCFileRefOpen("/Documents/default.realm.note") failed: 10
/Library/
/Library/Caches/
<…skip…>

System Specs

Please run the commands below in your Terminal.app and include it in the issue. Check when done and include results below.

  • 1. system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.15.7 (19H1030)
      Kernel Version: Darwin 19.6.0
      Boot Volume: MacintoshHD
      Boot Mode: Normal
      Computer Name: mbp
      User Name: user (user)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 2 days 16:54
  • 2. ios-deploy -V: 1.11.4
  • 3. xcodebuild -version
Xcode 12.4
Build version 12D4e
  • 4. xcode-select --print-path: /Applications/Xcode.app/Contents/Developer
  • 5. gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • 6. lldb --version
lldb-1200.0.44.2
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
  • If using NodeJS/npm
    • 7. npm -v
    • 8. node -v

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions