lionheart / openradar-mirror

A mirror of radars pulled from http://openradar.me/.
246 stars 17 forks source link

24929645: Cancelling an NSURLSession background download that was in progress when the app started causes all future downloads to fail when debugger is attached #7699

Open openradar-mirror opened 8 years ago

openradar-mirror commented 8 years ago

Description

Summary: If the app is started using the Xcode debugger, and recovers an in-progress download task from a background NSURLSession, cancelling the recovered task causes all future download tasks to either:

a) Hang forever and never actually progress or return any data b) Fail immediately with an NSError with domain NSPOSIXErrorDomain and code 2 ("No such file or directory")

Steps to Reproduce:

  1. Create an NSURLSession instance using a background NSURLSessionConfiguration object
  2. Start an NSURLSessionDownloadTask using the background session
  3. While the download is still in progress, close the app from Xcode, and then relaunch it from Xcode
  4. Recover the in-progress download task using [NSURLSession getTasksWithCompletionHandler:]
  5. Cancel the in-progress download task
  6. Attempt to start a new download task

Expected Results: The download should progress normally, including callbacks to URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:, and eventually complete successfully.

Actual Results: The download will actually either:

a) Hang forever and never actually progress or return any data. None of the NSURLSessionDownloadDelegate methods are ever called. b) Fail immediately (via a callback to URLSession:task:didCompleteWithError:) with an NSError with domain NSPOSIXErrorDomain and code 2 ("No such file or directory")

Both of the above appear to happen with essential equal frequency.

Version: iOS 9.2

Product Version: 9.2 Created: 2016-03-02T13:45:48.001280 Originated: 2016-03-02T00:00:00 Open Radar Link: http://www.openradar.me/24929645

Jageen commented 7 years ago

I am having same issue.