Skip to content

FFI panic guards cannot catch on iOS: the iOS profiles use panic = abort #5920

Open

Description

@romchornyi

Problem

The iOS Cargo profiles set panic = "abort" (Cargo.toml: release-ios, dev-ios). The FFI crates guard their exports with std::panic::catch_unwind (catch_panic_to_code, catch_spend_panic in rs-platform-wallet-ffi) and document that a panic comes back as a typed result code, for spends an "outcome unknown, do not resubmit" code. In the iOS artifacts those guards never run: a panic (for example block_on_worker's expect on a panicked worker task) aborts the host app instead.

This affects every guarded export, not one call site.

Fix direction

One of:

  • build the iOS artifacts with unwinding (panic = "unwind") and measure the size/performance cost; or
  • keep abort and remove panics from the paths these exports run (block_on_worker's expect returning an error instead), then document that the guards only apply to unwinding targets.

Raised in the reviews of #5860 and #5863.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions