{ "id": "149729", "key": "TIMOB-19334", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2015-07-16T02:15:55.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [ { "id": "48411", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "140651", "key": "TIMOB-19333", "fields": { "summary": "iOS: URLSession Module not working properly if system terminates the app during download", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "48410", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "133990", "key": "TIMOB-17502", "fields": { "summary": "iOS: URLSession Module returns blob instead of file location - causing low memory crash", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-02-28T19:55:57.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "1. Events not fired. To re-produce, download a large file > 1GB, press \"Home\" to make the app go to the background. Once the download finishes, only \"backgroundtransfer\" is fired. The other events are not: sessioneventscompleted, downloadcompleted, etc.\r\n\r\nWithout downloadcompleted, the file can't be saved. Without sessioneventscompleted, the app won't call endBackgroundHandler, and it will run over 30 seconds, eventually being terminated by the system.\r\n\r\nI think the problem is that after the download finishes, the file is \"copied\" instead of \"moved\" to the temp folder (see TIMOB-17502). Copying a large file can take longer than 30 seconds, so the system kills the app before it finishes copying. We should just \"move\" it to the temp location. This is also suggested in Apple's docs.\r\n\r\n2. If the download fails, the partial file is still copied to the temp folder. I think it should copy only when a download is successful. First, the file is useless. Second, \"downloadcompleted is not even called in this situation. The app can't get the handle of the partial file anyway. To re-produce, download a file. During the download, kill the app manually.\r\n\r\nAlso, in the above test, sometimes \"sessioncompleted\" isn't fired right after force closing the app (sometimes it is). The app won't be able to mark the download as failed if this issue happens. Again, I think this happens because the partial file is being copied to the temp folder, and if the file is large enough, \"sessioncompleted\" won't get fired before the app exits.\r\n\r\n3. When downloading a file (> 1GB) in the background, sometimes I got crash reports like the attached. I don't understand why the app was woken and running in the background over 3 minutes. Please investigate.\r\n\r\n4. With a medium size download (2-300MB) in the background, calling endBackgroundHandler when sessioneventscompleted fired throws the following error, and the callback is failed to complete. The size of the file doesn't matter. Use files around 2-300MB so that you can re-produce the issue. I think the issue is endBackgroundHandler itself alone.\r\n{code}\r\n[WARN] : ing: Application delegate received call to -application:handleEventsForBackgroundURLSession:completionHandler: but the completion handler was never called.\r\n[WARN] : assertion failed: 12H143: libxpc.dylib + 51923 [7FF71721-5624-3DDE-9615-146A4D8B7197]: 0x7d\r\n{code}", "attachment": [ { "id": "56171", "filename": "FRCC 7-15-15, 12-07 PM.crash", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-07-16T17:53:34.000+0000", "size": 42950, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "iOS: URLSession - large file download in the background - some events are not fired and other issues.", "creator": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "SDK 4.1.0/iOS 8", "comment": { "comments": [], "maxResults": 3, "total": 3, "startAt": 0 } } }