Conversation
A background URLSession raises an NSInvalidArgumentException, not an error, when uploadTask(with:fromFile:) cannot read the file. Swift cannot catch it, so it ends the app. The session transport now catches it with the same Objective-C helper as the 9.0.1 fix and throws. A simple attempt settles 'file' only when its staged body is gone, and otherwise issues again after a backoff. A chunked part refills later, like a failed part build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dmurphy5
added this pull request to stack #44
September 28, 2026 20:53
dmurphy5
marked this pull request as ready for review
September 29, 2026 15:19
elliottkember
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iOS,
uploadTask(with:fromFile:)on a background session throws an Objective-C exception when it cannot read the file. Swift cannot catch it, so the app dies. That is the Diana crash fixed on master in #48. This PR brings the same guard to the v10 transport.v10 is not exposed to the race that causes the Diana crash. It stages every body in its own folder and deletes staged files only on the coordinator queue, and it checks the body right before creating the task. The guard still matters, because any unreadable file ends the app, whatever the cause. It also keeps the helper from 9.0.1 in use once v10 is rebased onto master.
Before: an unreadable file ends the app.
After: the attempt gets no task.
fileonly when the staged body is gone. If the body is still there, the entry goes back to queued and is issued again after a backoff. This is the same rule as a file error at completion.What to look at
catchinissueinQueueCoordinator+Simple.swift. The retry goes throughdeferIssue, notscheduleRetry.scheduleRetrywould create the delayed task at once, fail the same way, and recurse.Transport.uploadnow throws. The fake transport has abeforeUploadhook, so tests can throw or delete the file just before the task is created.Decisions and trade-offs
RNBackgroundUpload.swiftwill still conflict there, because v10 rewrote it. Keep v10's side.RNBGUCatchException.his the only public header, and it imports only Foundation.dylan/v10-6-wifi-pause. It needs to be retargeted or recreated before it can ship this change.Test Plan
cd ios && swift testpasses all 204 tests. Three are new:file.yarn lint-root,yarn typecheckandyarn testpass with 189 tests.🤖 Generated with Claude Code