Automattic / Automattic/wordpress-rs

`execute()` on an owner-invalidated injected session crashes with an uncatchable NSException

Open
#1,516 0 comments 0 reactions 0 assignees View on GitHub
Bug Error Handling Swift
Dominant language
Rust
Stars
36
Forks
5
Avg merge
17h 30m
Merged PRs (30d)
43

Description

> Split out from Automattic/wordpress-rs#1497 — *Swift executor URLSession error audit*. Section D — Crash instead of classified error.
>
> File references are to `native/swift/Sources/wordpress-api/SafeRequestExecutor.swift` unless noted; `:NNN` line numbers were verified against `fix/converge-executor-error-classification`.

**Severity: low.** After the session owner calls `invalidateAndCancel`, the next `execute()`/`upload()` calls `session.dataTask`/`uploadTask` on the invalidated session, which raises Foundation's "task created in a session that has been invalidated" NSException — uncatchable from Swift. Requires caller misuse; worth a doc note that the injected `URLSession` must outlive the executor (or track `didBecomeInvalidWithError` and fail fast with `GenericError`). Incidentally, this lens confirmed the `.cancelled → CancellationError` mapping is honest: the library's own two cancel paths and an in-flight `invalidateAndCancel` all funnel there, and the challenge handler never returns `.cancelAuthenticationChallenge`, so no non-cancellation source of `.cancelled` exists in this executor. ✅

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with native/swift/Sources/wordpress-api/SafeRequestExecutor.swift and trace the execute/upload path after an injected URLSession is invalidated. Done means the injected-session lifetime requirement is documented, or invalidation is tracked so the call returns GenericError instead of raising the uncatchable NSException.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.