Skip to content

mobile_image_mounter: survive the CopyDevices hangup on legacy devices - #1898

Merged
doronz88 merged 1 commit into
masterfrom
bugfix/legacy-copy-devices-hangup
Sep 2, 2026
Merged

mobile_image_mounter: survive the CopyDevices hangup on legacy devices#1898
doronz88 merged 1 commit into
masterfrom
bugfix/legacy-copy-devices-hangup

Conversation

@doronz88

@doronz88 doronz88 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Fixes #1897.

The is_image_mounted() CopyDevices fallback (introduced in 9a09145 for the iOS 27.0 empty-ImageSignature quirk, first shipped in v10.10.0) broke Developer image mounting on legacy devices. Their mobile_storage_proxy (observed on iOS 12.5.7) answers the unknown CopyDevices command with UnknownCommand and then hangs up the connection. The fallback swallowed that as "not supported", but left the mounter on the dead socket, so the next command — upload_image()'s ReceiveBytes — failed with ConnectionResetError('Connection lost'). (The reported traceback pins this down: both LookupImage and CopyDevices completed full round trips, and the transport was already marked lost when ReceiveBytes was sent.)

The fix: when CopyDevices turns out unsupported, drop the hung-up connection (close()) so the lazy service proxy transparently reconnects for the next command, and memoize that the command is unsupported so the second mounted-check inside mount_image() does not provoke the hangup again.

Verified:

  • New device-free regression test simulating the legacy daemon (answers UnknownCommand, then hangs up): fails with ConnectionResetError: Connection lost before the fix, passes after.
  • Existing real-device test test_is_image_mounted_agrees_with_copy_devices passes against an iPhone 11 on iOS 27.0, confirming the iOS 27 fallback behavior is unchanged where CopyDevices is supported.
  • ruff check and pyright@1.1.411 --venvpath . clean.

@doronz88
doronz88 force-pushed the bugfix/legacy-copy-devices-hangup branch from 4129fcf to 0a9b3a8 Compare September 1, 2026 20:25
The is_image_mounted() CopyDevices fallback (added for the iOS 27.0
empty-ImageSignature quirk) broke mounting on legacy devices: their
mobile_storage_proxy (observed on iOS 12.5.7) answers the unknown
command with UnknownCommand and then hangs up the connection, so the
next command - upload_image()'s ReceiveBytes - failed with
ConnectionResetError('Connection lost').

When CopyDevices turns out unsupported, drop the hung-up connection so
the next command transparently reconnects, and remember the command is
unsupported so later mounted-checks in the same flow do not provoke the
hangup again.

Fixes #1897
@doronz88
doronz88 force-pushed the bugfix/legacy-copy-devices-hangup branch from 0a9b3a8 to 624aec0 Compare September 1, 2026 21:08
@doronz88
doronz88 merged commit e0dc322 into master Sep 2, 2026
24 checks passed
@doronz88
doronz88 deleted the bugfix/legacy-copy-devices-hangup branch September 2, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeveloperDiskImage Mounting fails on legacy devices

1 participant