github doronz88/pymobiledevice3 v11.43.0

latest release: v11.43.1
3 hours ago

Highlights

๐Ÿ› No more "File descriptor N is used by transport"

A connection closed while it was still starting up (TLS handshake in progress) could leave its fd half-owned: the socket was closed, but the asyncio transport still claimed the fd number. The next socket to reuse that number failed with RuntimeError: File descriptor N is used by transport, and in a long-running process, a pytest session for example, every later connection could break.

ServiceConnection was reworked so this can't happen: a connection is bound to its streams when it is created, TLS is negotiated at creation, and the stream transport is the only owner of the socket. Closing during the TLS upgrade, a send or a receive now cancels cleanly. A TCP connection that finishes connecting just as its caller is cancelled is closed instead of leaked.

For library users: ServiceConnection is a low-level class, and its API changed. The sync methods, start(), ssl_start() and abort() are gone, and DTXConnection.from_socket was removed. Services built on LockdownService and the service providers are unaffected.

๐Ÿ› Image mounting on pre-iOS 14 devices

On iOS 13 and earlier, the image mounter serves one host connection at a time, and mounter auto-mount and other mounter commands left their connection open, so the next mounter call hung. Every mounter connection is now closed after use. mounter list falls back to LookupImage on devices without CopyDevices, the developer disk image downloads into the per-user cache instead of a root-owned Xcode bundle, and --xcode accepts a directory. doctor gives up on an image mounter that doesn't answer after 10 s instead of waiting forever.

๐Ÿ› Fixes

  • The pre-iOS 14 DVT TLS handshake (complete it, then speak plaintext) now runs over the connection's own streams and waits for the close when it fails.
  • A service connection whose SSL start fails is closed.
  • Background tasks are started with asyncio.create_task() and named, so they show up recognizably when debugging.

๐Ÿงช Socket hygiene in the test suite

Every test, device tests included, now fails if it leaves a socket, transport, loop watch or fd open, on every platform. Module- and session-scoped fixtures are checked at their own teardown. Device tests take --udid to pick the device.

pytest -m device --udid <UDID>

What's Changed

Full Changelog: v11.42.0...v11.43.0

Don't miss a new pymobiledevice3 release

NewReleases is sending notifications on new releases.