Lot of NSURLSession errors when downloading too much files

In my app, I randomly break the background transfer. When it happens, background downloads stop working, even for the other application and then I receive a lot (can receive thousands) of different error messages in NSURLSessionDelegatedidCompleteWithError, eg.:



When it occurs, even uninstalling the application doesn't fix the issue. If I look at the nsurlsessiond process, it's using a lot of cpu (often going up to 100%). If I reboot and kill the app, than I have this error "Attempted to create a task in a session that has been invalidated", and then when I kill and restart the application it start working again.


I have been able to reproduce the issue on simulator and device, by doing a stress test in the following proof of concept. I tap on the startDownloads button many times (about 20-30 times to start about 2000-3000 downloads) and wait some seconds. Then I go to other applications, go back, and so on, and at some points, downloads just start failing non stop.


#import <UIKit/UIKit.h>
#import "ViewController.h"
#import "AppDelegate.h"
#include <libkern/OSAtomic.h>
#define DOWNLOAD_COUNT 100
#define SESSION_ID @"Test"
#define DOWNLOAD_URI @"http://smartusedeveastus.blob.core.windows.net/test/ImageSample2.png"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *ctlOutput;
- (IBAction)startDownloads;
- (IBAction)startInfiniteDownloads;
@property NSInteger TotalStarted;
@property NSInteger TotalSuccess;
@property NSInteger TotalError;
@property int Running;
@property (strong) NSOperationQueue *DownloadQueue;
@property (strong) NSOperationQueue *StartDownloadQueue;
@property (strong) NSURLSession *UrlSession;
- (void) OnSuccess;
- (void) OnError;
@end

@interface BackgroundTransfertSessionTestDelegate : NSObject <NSURLSessionDelegate>
@property (weak) ViewController *ViewController;
@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
  
    self.DownloadQueue = [NSOperationQueue new];
    self.StartDownloadQueue = [NSOperationQueue new];
    [self.StartDownloadQueue setMaxConcurrentOperationCount:DOWNLOAD_COUNT];
  
    self.UrlSession = [self createSession];
    [self.UrlSession getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
        for (NSURLSessionTask *task in downloadTasks) {
            self.TotalStarted++;
            [self UpdateUI];
          
            [task resume];
        }
    }];
}
- (NSURLSession *)createSession
{
  
    BackgroundTransfertSessionTestDelegate *customDelegate = [BackgroundTransfertSessionTestDelegate new];
    customDelegate.ViewController = self;
  
    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier: SESSION_ID];
    return [NSURLSession sessionWithConfiguration:configuration delegate:customDelegate delegateQueue:self.DownloadQueue];
}
- (IBAction)startDownloads
{
    for (int i = 0; i < DOWNLOAD_COUNT; i++)
    {
        [self.StartDownloadQueue addOperationWithBlock:^{
            [self startDownload: DOWNLOAD_URI];
        }];
    }
}
- (IBAction)startInfiniteDownloads
{
    int count = DOWNLOAD_COUNT;
  
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{
        if (self.Running < count)
        {
            [self startDownloads];
          
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1500 * NSEC_PER_MSEC), queue, ^{
                [self startInfiniteDownloads];
            });
        }
        else
        {
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_MSEC), queue, ^{
                [self startInfiniteDownloads];
            });
        }
    });
}
- (void) startDownload : (NSString *)uri
{
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString: uri]];
    NSURLSessionDownloadTask *result = [self.UrlSession downloadTaskWithRequest:request];
    if (result == nil){
        NSLog(@"FAILED TO START DOWNLOAD");
        return;
    }
  
    self.TotalStarted ++;
    OSAtomicIncrement32(&_Running);
    [self UpdateUI];
    [result resume];
}
- (void) OnSuccess
{
    self.TotalSuccess++;
    OSAtomicDecrement32(&_Running);
    if(_Running < 0){
        _Running = 0;
    }
    [self UpdateUI];
}
- (void) OnError
{
    self.TotalError++;
    OSAtomicDecrement32(&_Running);
    if(_Running < 0){
        _Running = 0;
    }
    [self UpdateUI];
}
- (void) UpdateUI
{
    if (![NSThread isMainThread])
    {
        [self performSelectorOnMainThread:@selector(UpdateUI) withObject:self waitUntilDone:NO];
        return;
    }
  
    self.ctlOutput.text = [NSString stringWithFormat: @"%@/%@ completed, %@ errors", @(self.TotalSuccess + self.TotalError), @(self.TotalStarted), @(self.TotalError)];
}
@end

@implementation BackgroundTransfertSessionTestDelegate
- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session
{
    AppDelegate *appDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
    if (appDelegate.sessionCompletionHandler)
    {
        void (^completionHandler)() = appDelegate.sessionCompletionHandler;
        appDelegate.sessionCompletionHandler = nil;
        completionHandler();
    }
    NSLog(@"URLSessionDidFinishEventsForBackgroundURLSession complete");
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
{
    if (error == nil)
    {
        NSLog(@"didCompleteWithSuccess");
        [self.ViewController OnSuccess];
    }
    else
    {
        NSLog([NSString stringWithFormat:@"didCompleteWithError: %@, %@", error.localizedDescription, error.debugDescription]);
        [self.ViewController OnError];
    }
}
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
{
    NSLog(@"didFinishDownloadingToURL");
}
@end

Any idea why it's happening?

Replies

It sounds like you're crashing

nsurlsessiond
, the daemon responsible for handling NSURLSession background sessions. This is obviously not good, and also indicative of a bug in
nsurlessiond
because app code isn't supposed to be able to cause it to fail like this .

If you import crash logs from the device (attach via USB, sync via iTunes, look in Xcode's Devices window), do you see any recent

nsurlsessiond
crash logs? If so, please post one.

I tap on the startDownloads button many times (about 20-30 times to start about 2000-3000 downloads) and wait some seconds.

So the total number of tasks you're starting is 40,000 to 90,000? Or 2,000 to 3,000? The latter should be fine; the former would definitely be asking for trouble.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

On iPad Air


I don't see any specific crash logs for nsurlsessiond, but I do see it crash three time at ~5 minutes interval in the "Unknown" crash log file, with "highwater" reason (see crash log below). I also saw it going at 200+mb in memory during th test.


When it occurs, I saw this in the output:


Jul 21 09:09:09 SU05 UserEventAgent[17] <Notice>: jetsam: kernel termination snapshot being created

Jul 21 09:09:09 SU05 ReportCrash[530] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

Jul 21 09:09:09 SU05 ReportCrash[530] <Notice>: Saved report to /Library/Logs/CrashReporter/JetsamEvent-2015-07-21-090909.ips

Jul 21 09:09:10 SU05 nsurlsessiond[531] <Error>: Restoring Task <com.test.bgtransferbug>.<Test>.<6419> which had never been started, will resume implicitly

Jul 21 09:09:11 SU05 nsurlsessiond[531] <Error>: Restoring Task <com.test.bgtransferbug>.<Test>.<6386> which had never been started, will resume implicitly

Jul 21 09:09:11 SU05 nsurlsessiond[531] <Error>: Restoring Task <com.test.bgtransferbug>.<Test>.<6420> which had never been started, will resume implicitly

...


Incident Identifier: 6A65FE1B-176A-459C-8345-0C4E21B462AA
CrashReporter Key:  8d050afc0c88e51b7d8711dd9a1dd18b19998aea
Hardware Model:      iPad4,1
OS Version:          iPhone OS 8.4 (12H143)
Kernel Version:      Darwin Kernel Version 14.0.0: Wed Jun 24 00:50:15 PDT 2015; root:xnu-2784.30.7~30/RELEASE_ARM64_S5L8960X
Date:                2015-07-21 09:09:09 -0400
Time since snapshot: 94 ms


Free pages:                              3852
Active pages:                            110985
Inactive pages:                          52826
Speculative pages:                      2477
Throttled pages:                        0
Purgeable pages:                        0
Wired pages:                            40673
File-backed pages:                      36033
Anonymous pages:                        130255
Compressions:                            250757
Decompressions:                          34271
Compressor Size:                        41132
Uncompressed Pages in Compressor:        87164
Page Size:                              16384
Largest process:  nsurlsessiond


Processes
    Name      |            <UUID>                |    CPU Time|    rpages|      purgeable| recent_max| lifetime_max| fds |  [reason]        | (state)


            pfd <c3eb74c6e4613861a8772c11d1fcc979>        0.012        106                0          -          244  50                      (daemon) (idle)
        BlueTool <8d9a41445dd331acbcb871f04a80300a>        0.067        137                0          -          494  50                      (daemon) (idle)
  fileproviderd <22189941339638ada46497917ee3f17e>        0.020        163                0          -          526  50                      (daemon) (idle)
AGXCompilerServi <f73e5c6efca03f568df2b167ffd4ee9e>        0.320        717                0          -          1048  50                      (daemon) (idle)
discoveryd_helpe <e75bb97c1afe35b7b5184832b7df0679>        0.100        156                0          -          666  50                      (daemon) (idle)
storebookkeeperd <d2821b5d01ca32e1a5bea62dcc41c9f5>        0.160        402                0          -          1345  50                      (daemon) (idle)
          oscard <ae72b3d4e3a33603abdffb7def49ac1a>        1.239        156                0          -          589  50                      (daemon) (idle)
    touchsetupd <5d41eefc449b3edabc3fa10fa65313b6>        0.021        186                0          -          663  50                      (daemon) (idle)
softwareupdated <e078229f6db13659900d5f191156c553>        0.018        143                0          -          451  50                      (daemon) (idle)
com.apple.Mobile <e5a032d3d5e533be97194a26bfacdaef>        0.104        163                0          -          629  50                      (daemon) (idle)
AGXCompilerServi <f73e5c6efca03f568df2b167ffd4ee9e>        0.034        551                0          -          769  50                      (daemon) (idle)
softwarebehavior <1f661aafc85f3fefbe8dd433d7d8c2ef>        5.010        147                0          -          481  50                      (daemon) (idle)
familynotificati <ab4ca53920293191a5ae6dff0d9af6b9>        0.136        391                0          -          2008  50                      (daemon) (idle)
com.apple.uifoun <35528c1315453961bb91bf613ff7f231>        0.116        228                0          -          795  50                      (daemon) (idle)
        keybagd <4bc147d470f53c34b123840f69a68ade>        0.016        122                0          -          338  50                      (daemon) (idle)
        carkitd <e4d1fdcbb5df3260bf45a39fccaad309>        0.135        304                0          -          1202  50                      (daemon) (idle)
  askpermissiond <5ea3d64d337734fc8efcd6fc4eefab92>        0.144        400                0          -          2053  50                      (daemon) (idle)
      MobileCal <22ab63ad60943d7b9da25ec7c798fb4f>        0.336        1419                0          -          3930  50                      (suspended)
CloudKeychainPro <9579ae7f2d7d363da8aa6ccd702a1e5f>        0.137        151                0          -          476  50                      (daemon) (idle)
            misd <ea86a50fa8f034eaa3be8a038bf6e368>        0.124        194                0          -          771  50                      (daemon) (idle)
    CMFSyncAgent <b73c53aa826438738b16397717c92290>        0.111        152                0          -          478  50                      (daemon) (idle)
          cplogd <3381b3ffdd84309eac6c3cae7cd7823d>        0.105        129                0          -          406  50                      (daemon) (idle)
IMDPersistenceAg <bc50e7a934d136ec86c230d7f0d2831a>        0.149        226                0          -          618  50                      (daemon) (idle)
            ind <fac58f87b50937f9878e633f170cf6b7>        0.248        475                0          -          1469  50                      (daemon) (idle)
FSTaskScheduler <55fd8be4e97f3907a992fbac694ffd6a>        0.562        138                0          -          398  50                      (daemon) (idle)
            tzd <042fc2b6fb8e31ada0ada192a18ee517>        0.604        204                0          -          660  50                      (daemon) (idle)
            adid <9403328cd66932aab7afcef8b03f6eea>        0.056        131                0          -          534  50                      (daemon) (idle)
AppleIDAuthAgent <d0869bfc46ff329190fc3d1dd10643a5>        0.326        445                0          -          1781  50                      (daemon) (idle)
  callservicesd <4f1c8ae6d2fe32a897158697a14cb5e4>        1.889        544                0          -          2062  50                      (daemon) (idle)
        healthd <e22c361469ba33d09b0f12ebfc6e8b51>        0.166        325                0          -          1132  50                      (daemon) (idle)
networkd_privile <100627057fff345499912e986f00e17f>        0.013        103                0          -          218  50                      (daemon) (idle)
AGXCompilerServi <f73e5c6efca03f568df2b167ffd4ee9e>        0.554        620                0          -          834  50                      (daemon) (idle)
      assistantd <6f8913c840d13733a62374a88189996b>        0.252        538                0          -          1899  50                      (daemon) (idle)
OTAPKIAssetTool <89e293d64f4b31dfb22228a9754b25d0>        0.129        187                0          -          605  50                      (daemon) (idle)
CacheDeleteDaily <498e3077e628311aa16cfc33f3b097af>        0.407        242                0          -          885  50                      (daemon) (idle)
EscrowSecurityAl <200c3afcedb437a1ac8ef71382576023>        0.154        227                0          -          1117  50                      (daemon) (idle)
WirelessRadioMan <b5ed8bc92577333bb0bde4a7d0605700>        2.836        298                0          -          944  50                      (daemon) (idle)
            fmfd <2c494c75ec8d3729a8f46663e97c8451>        0.589        513                0          -          1494  50                      (daemon) (idle)
CallHistorySyncH <2555f2ba8e1e36da943a8a023fedf603>        0.212        409                0          -          1253  50                      (daemon) (idle)
          homed <7372014f594e3534a899a4b12f4a1448>        0.380        414                0          -          1321  50                      (daemon) (idle)
com.apple.quickl <bc0b7662f1ed36548c9597c4a3951a47>        0.126        188                0          -          543  50                      (daemon) (idle)
        lockbot <bba2602860e537a5b70df66839a45f82>        0.121        170                0          -          676  50                      (daemon) (idle)
mobile_assertion <8bdd289b732836799170d7e15807bdb4>        0.082        134                0          -          356  50                      (daemon) (idle)
      librariand <c07c9d5972ce3123b074e366f687ebfb>        0.666        287                0          -          983  50                      (daemon) (idle)
CacheDeleteAppCo <516ee5e163063fd7b289b7ef7746fcb1>        0.517        220                0          -          712  50                      (daemon) (idle)
CacheDeleteITune <c7511d51b5d0364daffaefc527082b5b>        0.213        215                0          -          721  50                      (daemon) (idle)
CacheDeleteSyste <a7bf361eb597388794879c979ff3a62f>        0.129        147                0          -          442  50                      (daemon) (idle)
  webbookmarksd <a69b260139f63f53b243f7124be3502c>        0.183        334                0          -          1482  50                      (daemon) (idle)
CacheDeleteGeoTi <a0bf1fccd4943d2c822281864096ad7c>        0.167        196                0          -          587  50                      (daemon) (idle)
  CalendarWidget <0e549cca050b302e862e03d7cdb203fc>        0.806        1603                0          -          3244  50                      (suspended)
        deleted <062a2ecf46d237dc904c5cd3b35d4308>        0.490        238                0          -          783  50                      (daemon) (idle)
  medialibraryd <dceec7bdf23334909580e1cf9ee0f6c0>        2.494        511                0          -          1419  50                      (daemon) (idle)
    itunescloudd <0caa216dae1e34d39ca517987d617b56>        0.600        990                0          -          2360  50                      (daemon) (idle)
            pkd <b310fb2ecd273561a0b2ae4085aec266>        0.297        352                0          -          635  50                      (daemon) (idle)
            geod <c282e6ff858c300383b7ecbcfc2d4550>        1.132        748                0          -          1471  50                      (daemon) (idle)
        recentsd <d89ceddcd882327e866d5128e787f79b>        0.281        410                0          -          1404  50                      (daemon) (idle)
    mobileassetd <3a7fc4973b4a356bacedd4dda54b8836>        9.500        940                0          -          2296  50                      (daemon) (idle)
softwareupdatese <31db8ea9691f35638cda7930d6c44221>        8.388        1018                0          -          2424  50                      (daemon) (idle)
            awdd <408c51de954c3defaa6851f9906815e6>        4.470        274                0          -          1029  50                      (daemon) (idle)
    mediaremoted <2d2845cb4a3e3313ac3382380a783014>        1.882        420                0          -          1829  50                      (daemon) (idle)
DuetHeuristic-BM <bf4ccb75d3d53cae8efb7914059d5087>        6.987        334                0          -          1044  50                      (daemon) (idle)
          tipsd <ceb9956e17913dae91cc9c35dc5a4d2e>        0.133        257                0          -          975  50                      (daemon) (idle)
      mapspushd <901dc55b4db83bc9b99dc56302a98b84>        1.147        595                0          -          1548  50                      (daemon) (idle)
      calaccessd <997908717a0e30d0bdec9e3086a9ab2c>        1.311        829                0          -          1901  50                      (daemon) (idle)
lsuseractivityd <169aee9551d73959a014942ddbe6dcc5>        0.982        420                0          -          1932  50                      (daemon) (idle)
MobileGestaltHel <0fede746b67232f98b7aa05949010b0f>        0.198        170                0          -          533  50                      (daemon) (idle)
          cloudd <57f968d7ef6d3833b40bc9d0430a7bc7>        5.838        624                0          -          1552  50                      (daemon) (idle)
        profiled <69d20d3ff278307285042e112c0eb513>        0.760        463                0          -          1817  50                      (daemon) (idle)
containermanager <ead95a8cd8e2386085ec4a7c5e134f4e>        4.378        305                0          -          856  50                      (daemon) (idle)
        installd <91f2b526db023a1494c40fed7065272a>        14.735        670                0          -          1599  50                      (daemon) (idle)
            bird <0ab9710ae47131549d3a8ed7ab31bc8a>        0.297        351                0          -          1157  50                      (daemon) (idle)
        assetsd <63ea5a4386b739f18ac1fed57ca9af87>        0.950        1338                0          -          3227  50                      (daemon) (idle)
            swcd <83ae947dad063d54985a37e0477d9312>        0.025        161                0          -          495  50                      (daemon) (idle)
  findmydeviced <a221d31057ad34c185f2c92c66ece42b>        2.104        359                0          -          1228  50                      (daemon) (idle)
      aosnotifyd <9c403eb0a3b034588eb6f9ba9dd39b8d>        9.524        704                0          -          1565  50                      (daemon) (idle)
        nehelper <9b2e7f7e894032cd9235c325e923791c>        0.430        231                0          -          726  50                      (daemon) (idle)
mobile_installat <46e3a82c00703dbabbf8416a86ea6603>        0.787        305                0          -          861  50                      (daemon) (idle)
com.apple.Stream <e7dd1b01ada0329ab1b851a4b5227dcc>        0.029        155                0          -          516  50                      (daemon) (idle)
streaming_zip_co <d6d90e3c15583ebabaec84dbe111d304>        0.056        252                0          -          827  50                      (daemon) (idle)
          amfid <e4115724159f3261b7061999d101136f>        0.170        156                0          -          627  50                      (daemon) (idle)
          timed <cff5a367507338d09b379c4099696505>        42.975        404                0          -          1489  50                      (daemon) (idle)
  mobactivationd <24bc2e9dcb8f35a3a932cecdd8b33eb2>        0.428        213                0          -          691  50                      (daemon) (idle)
      accountsd <2142f0d7abe03be5ad8196ce4c1769c3>        6.617        1084                0          -          4166  50                      (daemon) (idle)
            afcd <0fc443de4f433fc7b1e59aff43618dde>        0.117        147                0          -          362  50                      (daemon) (idle)
            atc <094853db309930aaafc1bacfe374d1e3>        7.049        1340                0          -          4459  50                      (daemon) (idle)
      pipelined <262fd580ff203e5bae50c89bf6197d48>        0.345        493                0          -          1919  50                      (daemon) (idle)
    itunesstored <fae41ab56def388fbf305efc39f2a4e5>        39.864        2435                0          -          4088  100                      (daemon) (idle)
        routined <7b2d141703713e71995ed8d7ec8f40c2>        9.027        808                0          -          2127  50                      (daemon) (idle)
      securityd <da7d6697e09531528dfbaa9caeec0d2f>        17.885        716                0          -          1458  50                      (daemon) (idle)
  nsurlstoraged <112b36d469ad31f4b28cdb2a62ab60a7>        4.050        843                0          -          1953  100                      (daemon) (idle)
    SmartUseiOS <0b71200943383ac19b5e904eb9d9ea51>        82.962      38968                0          -        51439  50                      (suspended)
        misagent <b79107bd4f2f30dba11667b9fa166648>        1.406        170                0          -          562  50                      (daemon) (idle)
        sandboxd <fa039bb610013065abcb813373d724ca>        0.160        158                0          -          591  50                      (daemon) (idle)
coresymbolicatio <bb22d900394c38f899677a2dcc32d9d3>        0.018          98                0          -          220  50                      (daemon) (idle)
    diagnosticd <b8b88ecf403a3bea86f7e12d0fd28393>        0.019        110                0          -          223  50                      (daemon) (idle)
      coreduetd <2f1ead1f626d36b08afceb2ee72cda0f>        76.415        1084                0          -          2043  50                      (daemon) (idle)
            absd <5f289e0891403a658f7665d739c98937>        0.047        110                0          -          375  50                      (daemon)
            afcd <0fc443de4f433fc7b1e59aff43618dde>        0.132        145                0          -          338  50                      (daemon)
companion_proxy <4cab0538dd1537c9aabf3abee2d50508>        0.148        232                0          -          849  50                      (daemon)
notification_pro <ab6c5fb5076736abb20539091e7156f3>        0.114        135                0          -          420  50                      (daemon)
    debugserver <0de9af6a45b5309a8c85a475edf36fca>        4.180        261                0          -          684  50                      (daemon)
com.apple.dt.ins <c60bc44dcf173b3f9fa9a0c3e135515f>        29.047        271                0          -          779  50                      (daemon)
  nsurlsessiond <d1661c708f78320dbbe5a175f96facc7>      213.158      79761                0          -        71880  50      [highwater]      (daemon)
      MobileMail <7a67b896c6f73103a82396dcb793f01d>        12.834        2079                0          -          4501  50                      (resume) (continuous)
            *** <eb0e256edfc435b791bdb90f8d3cc401>        1.604        416                0          -          1255  50                      (daemon)
            tccd <eda84621bba33c6985607830bbd6d671>        0.314        267                0          -          874  50                      (daemon)
            kbd <c23c08f51d1933f4ac9b4cc24e8a3587>        1.218        935                0          -          2348  50                      (daemon)
  bgtransferbug <94593abcefbf345da11d15b74e46f516>        39.618      16261                0          -        17869  50                      (frontmost) (resume)
            ptpd <b77d0fa83eb239ebb61099cd8b659dd7>        0.379        807                0          -          2032  50                      (daemon)
        BTServer <4d903086540e3543a296fc53ae8c69cb>        1.222        487                0          -          1701  50                      (daemon)
          wifid <04502be9c3c43122ae0972092e2c632d>        77.085        630                0          -          1824  50                      (daemon)
      discoveryd <703eac07c6823551b351ca50c8617374>      102.462        632                0          -          2190  100                      (daemon)
      lockdownd <ed0a7a0a5ada33b0853384edf1ae5f06>        8.235        348                0          -          1032  50                      (daemon)
      locationd <1e440ce1316e339ea145284c8b703e01>      1390.167        2154                0          -          4145  100                      (daemon)
identityservices <734ce0ae27763f40813317388eeb2afd>        17.497        963                0          -          2086  50                      (daemon)
        imagent <4ff9e2c4c33c3c6bac323e545febcc21>        9.739        647                0          -          1507  50                      (daemon)
        syslogd <e985ebf1ab9638df9fbbd1af9565bf49>        54.864        277                0          -          2083  50                      (daemon)
    mediaserverd <f9793a15ea9d3f1c916d436b30703dd4>        15.037        1447                0          -          4488  50                      (daemon)
  iaptransportd <4177c2259494300487262cdb43f8fc50>        8.724        383                0          -          1383  50                      (daemon)
        cfprefsd <e4002097b3243ff1974f09a75c4c4cec>        11.955        363                0          -          696  50                      (daemon)
          powerd <a8f106915e3a3c168852ef86e1f10b29>        36.270        746                0          -          844  50                      (daemon)
        networkd <6d9c57d65d0635849e1bb8cadd6d6ad2>        82.462        667                0          -          1597  50                      (daemon)
            apsd <e41cbfa9060e31a9a0963eb754a12b08>        19.251        831                0          -          1919  50                      (daemon)
    dataaccessd <44721a09547a352da81b60440e015e0c>        53.085        1040                0          -          2993  50                      (daemon)
        sharingd <63a312fa980d32a1a0b7b4aa1840643c>        3.569        757                0          -          2463  50                      (daemon)
    syslog_relay <c43f857035553d4baf61439a4a407329>        1.405        118                0          -          238  50                      (daemon)
    SpringBoard <88bc313f728a34309d17425a2aaf4229>      270.957        8056                0          -        34852  50               
      backboardd <396c01940868356a8ffc9034969f6c22>      1282.795      14524                0          -          5578  50                      (daemon)
  UserEventAgent <e23056e8e53d3077af26829f9abdc867>      332.159        1087                0          -          2376  100                      (daemon)
      fseventsd <1f3a77a5cb1f3b0d8b0724186fb0e3ac>        23.052        567                0          -          1135  50                      (daemon)
        configd <0f7587f896863c9fa429b2e75b46a7d4>        89.662        491                0          -          1161  50                      (daemon)
    fairplayd.A2 <ea6d021cd6bc38158d25eef7d268b74a>        1.238        161                0          -          1420  50                      (daemon)
  wirelessproxd <41904877de153515bcce5dac1203f63b>        0.210        234                0          -          872  50                      (daemon)
      assertiond <04bfb60d7d963e37b769c9ad7a15e06b>        16.961        323                0          -          956  50                      (daemon)
      distnoted <797a7e87d6a83c21a5900263260d7e97>        2.885        194                0          -          331  50                      (daemon)
            ubd <72a7c79bedf53f079270d500f2a1ba87>        0.686        424                0          -          1342  50                      (daemon)
      aggregated <ff22d37c5925349da4364e4667cd5693>      540.914        1223                0          -          2326  50                      (daemon)
filecoordination <f92a0133924039cf9c93b11126fe5b57>        5.579        280                0          -          889  50                      (daemon)
      DTMobileIS <7d881285891b3c33a4779ee035bcc8bc>        24.277        1597                0          -          4598  50                      (daemon)
CommCenterClassi <c69aa8f401e235cc9bb49f05fc7e8724>        14.400        467                0          -          1680  50                      (daemon)
        notifyd <3d474663ff4d3afdb2b658f31641ba45>        29.539        364                0          -          427  50                      (daemon)


**End**


On iPad 2

I got a crash once, but I got errors even if I don't see the process crash. Still, here is the crash:


Incident Identifier: 383E47DB-50E3-420F-AA36-C3573D0E3137
CrashReporter Key:   322c9d24afecdd312215ffc7a81b6e758693b7e7
Hardware Model:      iPad2,4
Process:             nsurlsessiond [99]
Path:                /usr/libexec/nsurlsessiond
Identifier:          nsurlsessiond
Version:             ???
Code Type:           ARM (Native)
Parent Process:      launchd [1]


Date/Time:           2015-07-21 09:24:33.326 -0400
Launch Time:         2015-07-21 09:05:14.326 -0400
OS Version:          iOS 8.1.1 (12B435)
Report Version:      105


Exception Type:  EXC_RESOURCE
Exception Subtype: CPU
Exception Message: (Limit 50%) Observed 62% over 180 secs
Triggered by Thread:  5


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib         0x39148518 mach_msg_trap + 20
1   libsystem_kernel.dylib         0x3914830c mach_msg + 36
2   CoreFoundation                 0x2b00c596 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                 0x2b00ab5c __CFRunLoopRun + 1012
4   CoreFoundation                 0x2af57b2c CFRunLoopRunSpecific + 472
5   CoreFoundation                 0x2af5793e CFRunLoopRunInMode + 102
6   Foundation                     0x2bc9494c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 260
7   Foundation                     0x2bce2dc0 -[NSRunLoop(NSRunLoop) run] + 76
8   nsurlsessiond                 0x0006dcb4 0x6a000 + 15540
9   libdyld.dylib                 0x39096aac start + 0


Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib         0x391482c8 kevent64 + 24
1   libdispatch.dylib             0x3906ae44 _dispatch_mgr_invoke + 276
2   libdispatch.dylib             0x3906ab76 _dispatch_mgr_thread$VARIANT$mp + 34


Thread 2 name:  com.apple.NSURLConnectionLoader
Thread 2:
0   libsystem_kernel.dylib         0x39148518 mach_msg_trap + 20
1   libsystem_kernel.dylib         0x3914830c mach_msg + 36
2   CoreFoundation                 0x2b00c596 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                 0x2b00ab5c __CFRunLoopRun + 1012
4   CoreFoundation                 0x2af57b2c CFRunLoopRunSpecific + 472
5   CoreFoundation                 0x2af5793e CFRunLoopRunInMode + 102
6   CFNetwork                     0x2ab0c78a +[NSURLConnection(Loader) _resourceLoadLoop:] + 482
7   Foundation                     0x2bd59996 __NSThread__main__ + 1114
8   libsystem_pthread.dylib       0x391dae64 _pthread_body + 136
9   libsystem_pthread.dylib       0x391dadd6 _pthread_start + 114
10  libsystem_pthread.dylib       0x391d8b80 thread_start + 4


Thread 3 name:  com.apple.CFSocket.private
Thread 3:
0   libsystem_kernel.dylib         0x3915c08c __select + 20
1   CoreFoundation                 0x2b010d1e __CFSocketManager + 486
2   libsystem_pthread.dylib       0x391dae64 _pthread_body + 136
3   libsystem_pthread.dylib       0x391dadd6 _pthread_start + 114
4   libsystem_pthread.dylib       0x391d8b80 thread_start + 4


Thread 4:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 5 name:  Dispatch queue: com.apple.nsurlsessiond.session-manager
Thread 5 Attributed:
0   libsystem_malloc.dylib         0x39183f86 0x39183000 + 3974
1   libsystem_malloc.dylib         0x39187444 0x39183000 + 17476
2   libsystem_malloc.dylib         0x391873d2 0x39183000 + 17362
3   CoreFoundation                 0x2b042f80 0x2af3e000 + 1068928
4   CoreFoundation                 0x2af9fefe 0x2af3e000 + 401150
5   Foundation                     0x2bceaf0c 0x2bc89000 + 401164
6   Foundation                     0x2bceb1a2 0x2bc89000 + 401826
7   CFNetwork                     0x2ab70ea0 0x2aa90000 + 921248
8   Foundation                     0x2bceb420 0x2bc89000 + 402464
9   CFNetwork                     0x2ab6756c 0x2aa90000 + 882028
10  Foundation                     0x2bceb420 0x2bc89000 + 402464
11  Foundation                     0x2bcec62a 0x2bc89000 + 407082
12  Foundation                     0x2bcec2fa 0x2bc89000 + 406266
13  Foundation                     0x2bceb420 0x2bc89000 + 402464
14  Foundation                     0x2bcf17bc 0x2bc89000 + 427964
15  nsurlsessiond                 0x00075b2c 0x6a000 + 47916
16  libdispatch.dylib             0x3905b40c 0x39059000 + 9228
17  libdispatch.dylib             0x39064686 0x39059000 + 46726
18  nsurlsessiond                 0x00075a0a 0x6a000 + 47626
19  libdispatch.dylib             0x3905b420 0x39059000 + 9248
20  libdispatch.dylib             0x390655d4 0x39059000 + 50644
21  libdispatch.dylib             0x390650a4 0x39059000 + 49316
22  libdispatch.dylib             0x390670d0 0x39059000 + 57552
23  libdispatch.dylib             0x390681f6 0x39059000 + 61942
24  libsystem_pthread.dylib       0x391d8e22 0x391d8000 + 3618
25  libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 6:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 7:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 8:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 9:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 10:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 11:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 12:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 13:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 14:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 15:
0   libsystem_kernel.dylib         0x3915c9cc __workq_kernreturn + 8
1   libsystem_pthread.dylib       0x391d8e9c _pthread_wqthread + 788
2   libsystem_pthread.dylib       0x391d8b74 start_wqthread + 4


Thread 5 crashed with ARM Thread State (32-bit):
    r0: 0x1588de00    r1: 0x00002378      r2: 0x00000011      r3: 0x00000011
    r4: 0x00000004    r5: 0x001eea00      r6: 0x001ee500      r7: 0x026069b8
    r8: 0x00000004    r9: 0x00000011     r10: 0x001eea00     r11: 0x1588de00
    ip: 0x00000008    sp: 0x02606934      lr: 0x00000001      pc: 0x39183f86
  cpsr: 0x20000030


Bad magic 0x2AF57943
Microstackshots: 1 (from 2147483647-08-13 07:24:00 -0500 to 2147483647-08-13 07:24:00 -0500)
  1 ??? [0x1e6c08]
    1 CoreFoundation 0x2af3e000 + 838497 [0x2b00ab61]
      1 ??? [0x1e5f70]
        1 CoreFoundation 0x2af3e000 + 845211 [0x2b00c59b]
          1 ??? [0x1e5f30]
            1 libsystem_kernel.dylib 0x39147000 + 4881 [0x39148311]
              1 ??? [0x1e5ef4]
                1 libsystem_kernel.dylib 0x39147000 + 5400 [0x39148518]
                 *1 ??? [0x80012c7d]


Binary Images:
0x6a000 - 0xa9fff nsurlsessiond armv7  <d04dc25e93283de3b7ee8db12bd33953> /usr/libexec/nsurlsessiond
0x1feec000 - 0x1ff0ffff dyld armv7  <9ccfe28fdc823833b1927a781832605e> /usr/lib/dyld
0x29af5000 - 0x29c61fff AVFoundation armv7  <b1b9e3bf18b23e3cb7923bfe4a7fe497> /System/Library/Frameworks/AVFoundation.framework/AVFoundation
0x29c62000 - 0x29cc0fff libAVFAudio.dylib armv7  <5dc6f29e995d39c18712dec40a9ca7c6> /System/Library/Frameworks/AVFoundation.framework/libAVFAudio.dylib
0x29cfb000 - 0x29cfbfff Accelerate armv7  <79b84eb74f0234e4ac81d7c906641804> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x29d0c000 - 0x29f25fff vImage armv7  <5ec259488c033a4f98b0f28ee14ecfc1> /System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage
0x29f26000 - 0x2a003fff libBLAS.dylib armv7  <e5395e7ee45e353498dcb4e956bcf272> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x2a004000 - 0x2a2c7fff libLAPACK.dylib armv7  <689f4395215e3cef8bafa5f21e288cfe> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x2a2c8000 - 0x2a2dafff libLinearAlgebra.dylib armv7  <b86c17150d2133b8baea239d17df5e28> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLinearAlgebra.dylib
0x2a2db000 - 0x2a34ffff libvDSP.dylib armv7  <bc358a699c2132a09e9150cfc2db34bb> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x2a350000 - 0x2a361fff libvMisc.dylib armv7  <1a0561dd472b3c04ad84e0c48896173d> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvMisc.dylib
0x2a362000 - 0x2a362fff vecLib armv7  <f4dbfd05244f30b2905a5dbf06f15fc8> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x2a363000 - 0x2a389fff Accounts armv7  <90965bef7f403d9791b800e9307da469> /System/Library/Frameworks/Accounts.framework/Accounts
0x2a6b7000 - 0x2a928fff AudioToolbox armv7  <0e7d115e201731ae9002e3ac0e1cf723> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x2aa90000 - 0x2ac18fff CFNetwork armv7  <91a44f5c23e4349e9532c46bcacf8793> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x2ac19000 - 0x2ac9afff CloudKit armv7  <3911d5e793ad3a6bb0a3218b99d6cdd6> /System/Library/Frameworks/CloudKit.framework/CloudKit
0x2ac9b000 - 0x2acf9fff CoreAudio armv7  <5857be698f7b3a3d865b418b0a80dd95> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x2ad14000 - 0x2ad31fff CoreBluetooth armv7  <9c118ad461f83876a2d73ed41a6d0a76> /System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth
0x2ad32000 - 0x2af3dfff CoreData armv7  <e179cf2529fc39ccb17bc43d6a1ad54e> /System/Library/Frameworks/CoreData.framework/CoreData
0x2af3e000 - 0x2b26efff CoreFoundation armv7  <8903e0338b7a3055a6da8d09d9dd819c> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x2b26f000 - 0x2b398fff CoreGraphics armv7  <e945d96898fc3b109fa229c01afc6aab> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x2b6fb000 - 0x2b752fff CoreLocation armv7  <74ede6cbed043590aa008c98ec0292d5> /System/Library/Frameworks/CoreLocation.framework/CoreLocation
0x2b784000 - 0x2b81efff CoreMedia armv7  <e686ff922549369ebf5aad7d9b1cd122> /System/Library/Frameworks/CoreMedia.framework/CoreMedia
0x2b81f000 - 0x2b8defff CoreMotion armv7  <262ac8188a9e34d8bc260b836c19916a> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x2b8df000 - 0x2b93dfff CoreTelephony armv7  <2c9a0ea2bc4631f09f0ad3482279ed2a> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x2b93e000 - 0x2ba05fff CoreText armv7  <eed94d72acb13e71881d91d8eab797bc> /System/Library/Frameworks/CoreText.framework/CoreText
0x2ba06000 - 0x2ba1bfff CoreVideo armv7  <6c8fef3be5df3be49e848caafb61f3d4> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x2bc89000 - 0x2be8bfff Foundation armv7  <6fcf1d26cba338be8494994f08313889> /System/Library/Frameworks/Foundation.framework/Foundation
0x2bf6c000 - 0x2bfc2fff IOKit armv7  <57f43286391832bf833d098bd0b62595> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x2bfc3000 - 0x2c205fff ImageIO armv7  <7a956ae39b1332b3b6ca5323e4690b6d> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x2c828000 - 0x2c830fff MediaAccessibility armv7  <ac5de26eeeb93c8c8febc8360071cc5c> /System/Library/Frameworks/MediaAccessibility.framework/MediaAccessibility
0x2ca0b000 - 0x2cd86fff MediaToolbox armv7  <fe73a1aebb0b36129799d6965cf5e6a3> /System/Library/Frameworks/MediaToolbox.framework/MediaToolbox
0x2ce46000 - 0x2ceb2fff Metal armv7  <209361201b49352a848591a82e8a8c72> /System/Library/Frameworks/Metal.framework/Metal
0x2ceb3000 - 0x2cf42fff MobileCoreServices armv7  <4a9e490a4ed53612a238c0d760e38b91> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x2da0d000 - 0x2da15fff OpenGLES armv7  <0e7ab2b493eb3e51b541842bda102761> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x2da17000 - 0x2da17fff libCVMSPluginSupport.dylib armv7  <754a49b6b063344288d7163e81e6efcd> /System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib
0x2da18000 - 0x2da1afff libCoreFSCache.dylib armv7  <387bf7c1911a3e749f83037d6655a0e9> /System/Library/Frameworks/OpenGLES.framework/libCoreFSCache.dylib
0x2da1b000 - 0x2da1efff libCoreVMClient.dylib armv7  <9ac8ebec447238cab588905e8173abec> /System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
0x2da1f000 - 0x2da27fff libGFXShared.dylib armv7  <a8cdc3dc15ce36d5a98e86677be92474> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x2da28000 - 0x2da67fff libGLImage.dylib armv7  <fbe6d2e0bd513965aff8eb090786e6b3> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x2df0a000 - 0x2e05bfff QuartzCore armv7  <fb4d51b6117a343cbeedc0045821a7d3> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x2e29c000 - 0x2e2dcfff Security armv7  <255df08b5ec837ba9a07a59fb7122687> /System/Library/Frameworks/Security.framework/Security
0x2e480000 - 0x2e4dcfff SystemConfiguration armv7  <054ebf2b18913f589c139e058bae2ec9> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x2ed83000 - 0x2edeafff ************ armv7  <c5c531ac886c3ccdb103d77da4647eb0> /System/Library/Frameworks/************.framework/************
0x2f49b000 - 0x2f49ffff AggregateDictionary armv7  <bf6e9572174f3a09985abe1a3ed3d052> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary
0x2f665000 - 0x2f68ffff AirPlaySupport armv7  <75be790008cd3fed80322dc0406f8a0a> /System/Library/PrivateFrameworks/AirPlaySupport.framework/AirPlaySupport
0x2f888000 - 0x2f8cafff AppSupport armv7  <451dd95cedd037b7b124522fdb2fb545> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x2f9fa000 - 0x2fa37fff AppleJPEG armv7  <105c3957b1323c49a31e94c43f643b61> /System/Library/PrivateFrameworks/AppleJPEG.framework/AppleJPEG
0x2fa42000 - 0x2fa54fff ApplePushService armv7  <b88bd0d1314432dea65f7de3cae40178> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService
0x2fa55000 - 0x2fa5bfff AppleSRP armv7  <c320a73d635938c4998bcf2ec77997e4> /System/Library/PrivateFrameworks/AppleSRP.framework/AppleSRP
0x2fa90000 - 0x2fa99fff AssertionServices armv7  <23d8209940e13b43abf99cfc04a22682> /System/Library/PrivateFrameworks/AssertionServices.framework/AssertionServices
0x2fa9a000 - 0x2fab2fff AssetsLibraryServices armv7  <32f81c890aa03d709296da592b7f6158> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices
0x2fad8000 - 0x2fadcfff BTLEAudioController armv7  <600bfbfc528a34378b0b976b908b49fc> /System/Library/PrivateFrameworks/BTLEAudioController.framework/BTLEAudioController
0x2fadd000 - 0x2faf4fff BackBoardServices armv7  <090e9ea5f5ea3b179298b23c0de69cd7> /System/Library/PrivateFrameworks/BackBoardServices.framework/BackBoardServices
0x2faf7000 - 0x2fb2cfff BaseBoard armv7  <d051b61623163e5db3572f35442b4fb8> /System/Library/PrivateFrameworks/BaseBoard.framework/BaseBoard
0x2fb2d000 - 0x2fb33fff BluetoothManager armv7  <e3b031c114123d17ba5ddda8cbe78723> /System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager
0x2fd5c000 - 0x2fd64fff CaptiveNetwork armv7  <4bf8c2da6cae3b32b0d79da0063ea5b6> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork
0x2fd65000 - 0x2fe87fff ********* armv7  <01a159ec3c0f36d89970ee8ff7d0082c> /System/Library/PrivateFrameworks/*********.framework/*********
0x2ffde000 - 0x2fffffff ChunkingLibrary armv7  <524a86c48bb23111b9806d7989dfb828> /System/Library/PrivateFrameworks/ChunkingLibrary.framework/ChunkingLibrary
0x30000000 - 0x3003bfff CloudDocs armv7  <9da8ee34b4533d5692df1876deda991b> /System/Library/PrivateFrameworks/CloudDocs.framework/CloudDocs
0x304ac000 - 0x304bcfff CommonUtilities armv7  <2c365dc9d8283a62b5d26bde20e908d3> /System/Library/PrivateFrameworks/CommonUtilities.framework/CommonUtilities
0x30570000 - 0x30573fff CoreAUC armv7  <bd82bbb4214d31ba824f0d2796989976> /System/Library/PrivateFrameworks/CoreAUC.framework/CoreAUC
0x305ed000 - 0x30607fff CoreDuet armv7  <c2784c5d68853bd18c53ab449fbe8a08> /System/Library/PrivateFrameworks/CoreDuet.framework/CoreDuet
0x3060c000 - 0x3061bfff CoreDuetDaemonProtocol armv7  <834a5b4ade9e323d99b9190557b33f91> /System/Library/PrivateFrameworks/CoreDuetDaemonProtocol.framework/CoreDuetDaemonProtocol
0x30622000 - 0x30624fff CoreDuetDebugLogging armv7  <6dfa638a467c3db09dae686312ab014e> /System/Library/PrivateFrameworks/CoreDuetDebugLogging.framework/CoreDuetDebugLogging
0x309f1000 - 0x30a0ffff CoreServicesInternal armv7  <fade5aa36a5f3e13884312dcce2ce920> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/CoreServicesInternal
0x30c8e000 - 0x30cf7fff CoreUtils armv7  <bd9650a7f3753160ac938617b8220a51> /System/Library/PrivateFrameworks/CoreUtils.framework/CoreUtils
0x30cf8000 - 0x30cfdfff CrashReporterSupport armv7  <2bf025aa00f039d59e317e4bbe839e2c> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport
0x30fa7000 - 0x30fadfff DataMigration armv7  <0d2533e6d6953ca0a13dca0f1c56956d> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration
0x30fb7000 - 0x30fb8fff DiagnosticLogCollection armv7  <0999a3d19f1c3bd191bb788578dfc4e8> /System/Library/PrivateFrameworks/DiagnosticLogCollection.framework/DiagnosticLogCollection
0x30ff2000 - 0x31011fff EAP8021X armv7  <22701a5a231b3690bd628d3b03777d98> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X
0x3158c000 - 0x3158cfff FontServices armv7  <af1240e62fd931898782f3650b1396a2> /System/Library/PrivateFrameworks/FontServices.framework/FontServices
0x3158d000 - 0x31661fff libFontParser.dylib armv7  <f1f035ec893036f5b3768f138f12a53b> /System/Library/PrivateFrameworks/FontServices.framework/libFontParser.dylib
0x31751000 - 0x3176cfff FrontBoardServices armv7  <163cfd1e31893650ba487c810bbe7a20> /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices
0x32051000 - 0x32067fff GenerationalStorage armv7  <3c6bb4fc1b663ec3bb79709587935963> /System/Library/PrivateFrameworks/GenerationalStorage.framework/GenerationalStorage
0x32068000 - 0x322d5fff GeoServices armv7  <b53000bf129b3017b80da4a8817db150> /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
0x322d6000 - 0x322e6fff GraphicsServices armv7  <ee8b5d298a8236858aa4287ca6f2e0b2> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x3254b000 - 0x325a1fff IDS armv7  <75c8d418d5b43c0ca8552c9be00a7cd4> /System/Library/PrivateFrameworks/IDS.framework/IDS
0x325a2000 - 0x325c4fff IDSFoundation armv7  <5b7681220a993228a4aa076c9d39de43> /System/Library/PrivateFrameworks/IDSFoundation.framework/IDSFoundation
0x32775000 - 0x327d9fff IMFoundation armv7  <020b1ee36b5a3f7690cfc494a6e2dc2d> /System/Library/PrivateFrameworks/IMFoundation.framework/IMFoundation
0x327e1000 - 0x327e4fff IOAccelerator armv7  <4da2a2cf04893925ab5329d1de2b6575> /System/Library/PrivateFrameworks/IOAccelerator.framework/IOAccelerator
0x327e7000 - 0x327edfff IOMobileFramebuffer armv7  <08269cc472483b6eb829555aa6ddc685> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x327ee000 - 0x327f3fff IOSurface armv7  <4201a5dacbbf3c0f83e2aadb55ac3415> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x327f4000 - 0x327f5fff IOSurfaceAccelerator armv7  <88b723f5bfe03571a396cc49741620ca> /System/Library/PrivateFrameworks/IOSurfaceAccelerator.framework/IOSurfaceAccelerator
0x32a2a000 - 0x32acafff ManagedConfiguration armv7  <0e1b7d85d68e3713aca7ae5e6198d277> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration
0x32ad4000 - 0x32ad5fff Marco armv7  <fa5b05c7bf033ceb94486dce9e07c697> /System/Library/PrivateFrameworks/Marco.framework/Marco
0x32ad6000 - 0x32b4dfff MediaControlSender armv7  <78c75f325be63b6bb35bd991c141aa3e> /System/Library/PrivateFrameworks/MediaControlSender.framework/MediaControlSender
0x32bec000 - 0x32bfefff MediaRemote armv7  <9cd03aaa29d63f8a8957cfe7dd6f8184> /System/Library/PrivateFrameworks/MediaRemote.framework/MediaRemote
0x32bff000 - 0x32c0efff MediaServices armv7  <be9a8d82dc173515ae7d697333df31fb> /System/Library/PrivateFrameworks/MediaServices.framework/MediaServices
0x32dbb000 - 0x32dc4fff MobileBluetooth armv7  <65537c8b75e339f786bc768e786b7aa3> /System/Library/PrivateFrameworks/MobileBluetooth.framework/MobileBluetooth
0x32de8000 - 0x32deffff MobileInstallation armv7  <615d9a6675ee39c9a49f4293ac02f505> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x32df0000 - 0x32dfcfff MobileKeyBag armv7  <b98f16e34717344e8e3df6ae7ad4eb35> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x32e29000 - 0x32e2cfff MobileSystemServices armv7  <c5fdefa4cea23a0fbe856e052b1645fd> /System/Library/PrivateFrameworks/MobileSystemServices.framework/MobileSystemServices
0x32e4e000 - 0x32e5bfff MobileWiFi armv7  <e18b965671ab3a97a018ad79502708f4> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi
0x330d3000 - 0x330d8fff Netrb armv7  <5f55aa01b0e830d1836eebe5f526c488> /System/Library/PrivateFrameworks/Netrb.framework/Netrb
0x330d9000 - 0x330dffff NetworkStatistics armv7  <ac0e65da55a13b7b83063ada9aa8c8ac> /System/Library/PrivateFrameworks/NetworkStatistics.framework/NetworkStatistics
0x33103000 - 0x33105fff OAuth armv7  <a37bdb65bcf536d685a023e9b9efe258> /System/Library/PrivateFrameworks/OAuth.framework/OAuth
0x3398a000 - 0x339b1fff PersistentConnection armv7  <dfef66a09fe33166800f1c9e5e33ad7b> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection
0x33df5000 - 0x33dfcfff PowerLog armv7  <45594755e8e230e2a46d3bdf0cc87ae4> /System/Library/PrivateFrameworks/PowerLog.framework/PowerLog
0x3418a000 - 0x34196fff ProtocolBuffer armv7  <a6b722673856304bb5d4a81d8a823c30> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer
0x341c9000 - 0x34237fff Quagga armv7  <a30e9231f6653d0d81f895084e159dc1> /System/Library/PrivateFrameworks/Quagga.framework/Quagga
0x345d3000 - 0x345edfff SpringBoardServices armv7  <ae711fd982403c14961bd7342b4d20fa> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x34959000 - 0x34a71fff StoreServices armv7  <d0c44d76fedb339cb18e615b3851ca4a> /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices
0x34b34000 - 0x34b3afff SymptomReporter armv7  <9943c2e509af34fa80f08e63c6ba674e> /System/Library/PrivateFrameworks/Symptoms.framework/Frameworks/SymptomReporter.framework/SymptomReporter
0x34b43000 - 0x34b45fff TCC armv7  <4603e107a0da36afb0577925d23ad485> /System/Library/PrivateFrameworks/TCC.framework/TCC
0x35c3b000 - 0x35c3efff UserFS armv7  <eaa14007b6683b07ae6871e6f9969148> /System/Library/PrivateFrameworks/UserFS.framework/UserFS
0x37eed000 - 0x37f03fff libCRFSuite.dylib armv7  <746f523326833d11a24e2142871aeaca> /usr/lib/libCRFSuite.dylib
0x38052000 - 0x38069fff libMobileGestalt.dylib armv7  <9770005d080e37bfb257218f383403a6> /usr/lib/libMobileGestalt.dylib
0x3808f000 - 0x38090fff libSystem.B.dylib armv7  <d6821a14f9b53bd9b13b6596a5a28ef8> /usr/lib/libSystem.B.dylib
0x38101000 - 0x38145fff libTelephonyUtilDynamic.dylib armv7  <55ab7f3a82ce3296801bacc3d5d82a7a> /usr/lib/libTelephonyUtilDynamic.dylib
0x38255000 - 0x38277fff libarchive.2.dylib armv7  <9c5747f3bde23eb9904f25f4d2a48482> /usr/lib/libarchive.2.dylib
0x382a7000 - 0x382b3fff libbsm.0.dylib armv7  <fc5847733d0b3040a6f78db015002c29> /usr/lib/libbsm.0.dylib
0x382b4000 - 0x382bdfff libbz2.1.0.dylib armv7  <43c20d2a3ae630b2b00af23b29c1cf4a> /usr/lib/libbz2.1.0.dylib
0x382be000 - 0x38308fff libc++.1.dylib armv7  <04463e09c37b388fb4f0d9b578ff27af> /usr/lib/libc++.1.dylib
0x38309000 - 0x38324fff libc++abi.dylib armv7  <201e1c5ea8a53c70aa976d54f4518c2e> /usr/lib/libc++abi.dylib
0x38334000 - 0x3833cfff libcupolicy.dylib armv7  <a951b132d31d31a7b7fb1233dd8b8477> /usr/lib/libcupolicy.dylib
0x38363000 - 0x3837bfff libextension.dylib armv7  <ff613df2137d3c1888ed1615ed64e517> /usr/lib/libextension.dylib
0x384b0000 - 0x3859dfff libiconv.2.dylib armv7  <a0d4cae016673389ad357ea1033c1f4d> /usr/lib/libiconv.2.dylib
0x3859e000 - 0x3870cfff libicucore.A.dylib armv7  <538b3775a2e2314ea196e48929be2eeb> /usr/lib/libicucore.A.dylib
0x38719000 - 0x38719fff liblangid.dylib armv7  <3399f30bf7ea3551b32b052dc3a87aad> /usr/lib/liblangid.dylib
0x3871a000 - 0x38724fff liblockdown.dylib armv7  <3bfa793f65d93897ac94a9b697303fcd> /usr/lib/liblockdown.dylib
0x38725000 - 0x3873afff liblzma.5.dylib armv7  <0ede283640b036dbbcbbf042f3771b24> /usr/lib/liblzma.5.dylib
0x38ab6000 - 0x38acafff libmis.dylib armv7  <52bc0b0ba1843be58d928607c9bee017> /usr/lib/libmis.dylib
0x38af4000 - 0x38ceefff libobjc.A.dylib armv7  <fcccdef901003a469d4b5263d611846a> /usr/lib/libobjc.A.dylib
0x38de4000 - 0x38e89fff libsqlite3.dylib armv7  <a81902eff78c39308cc8040889887d2e> /usr/lib/libsqlite3.dylib
0x38ed7000 - 0x38efefff libtidy.A.dylib armv7  <abe9491c2435315fab7fa38577d67d15> /usr/lib/libtidy.A.dylib
0x38f0b000 - 0x38fc1fff libxml2.2.dylib armv7  <953ce5aaa1833fc098761e2888d38f14> /usr/lib/libxml2.2.dylib
0x38fe4000 - 0x38ff0fff libz.1.dylib armv7  <5a3030aa2bd43c3db1b41e49b65d8852> /usr/lib/libz.1.dylib
0x38ff1000 - 0x38ff5fff libcache.dylib armv7  <6019d220fb3e3fa69a198f520232debe> /usr/lib/system/libcache.dylib
0x38ff6000 - 0x38ffffff libcommonCrypto.dylib armv7  <e508e2b2b9253230bb6602ea93d184ea> /usr/lib/system/libcommonCrypto.dylib
0x39000000 - 0x39004fff libcompiler_rt.dylib armv7  <ffb897c303913d1db3285b5e8356e5d2> /usr/lib/system/libcompiler_rt.dylib
0x39005000 - 0x3900bfff libcopyfile.dylib armv7  <fa6addf1824235a9a978f4e8f1d885ed> /usr/lib/system/libcopyfile.dylib
0x3900c000 - 0x39058fff libcorecrypto.dylib armv7  <852075abb4e5331ea68af0c15b15d9ea> /usr/lib/system/libcorecrypto.dylib
0x39059000 - 0x39094fff libdispatch.dylib armv7  <d56533a0119f32fa8d7d07fedd50b93c> /usr/lib/system/libdispatch.dylib
0x39095000 - 0x39096fff libdyld.dylib armv7  <cf3e3251e86c3bfd8bec6907b26038fa> /usr/lib/system/libdyld.dylib
0x39097000 - 0x39097fff libkeymgr.dylib armv7  <45a6025e9a58300e94c36b4ed262c6cd> /usr/lib/system/libkeymgr.dylib
0x39098000 - 0x39098fff liblaunch.dylib armv7  <5456bea7a1063c2da6cbe4038a71ed04> /usr/lib/system/liblaunch.dylib
0x39099000 - 0x3909cfff libmacho.dylib armv7  <5f0fa3d21ae331739966a3ccc8020380> /usr/lib/system/libmacho.dylib
0x3909d000 - 0x3909efff libremovefile.dylib armv7  <01f437d328da35deab8aabf436d82e7a> /usr/lib/system/libremovefile.dylib
0x3909f000 - 0x390b0fff libsystem_asl.dylib armv7  <46fb91bd43e737c7a8638967c6efe467> /usr/lib/system/libsystem_asl.dylib
0x390b1000 - 0x390b1fff libsystem_blocks.dylib armv7  <783efecc85a832ac962bea5bc4d365d5> /usr/lib/system/libsystem_blocks.dylib
0x390b2000 - 0x39114fff libsystem_c.dylib armv7  <ce110d5651ec34fc96f8648ccd34a18c> /usr/lib/system/libsystem_c.dylib
0x39115000 - 0x39117fff libsystem_configuration.dylib armv7  <c8635900dafa339daa83039ee4c6f7dd> /usr/lib/system/libsystem_configuration.dylib
0x39118000 - 0x39119fff libsystem_coreservices.dylib armv7  <4e58541adedc3c798fe75b1945ed38cf> /usr/lib/system/libsystem_coreservices.dylib
0x3911a000 - 0x39126fff libsystem_coretls.dylib armv7  <fb441163ce283f7eb8a0a05992804873> /usr/lib/system/libsystem_coretls.dylib
0x39127000 - 0x3912dfff libsystem_dnssd.dylib armv7  <0a86f809f51a3ca3906ccc81b4fa7ec1> /usr/lib/system/libsystem_dnssd.dylib
0x3912e000 - 0x39146fff libsystem_info.dylib armv7  <f79c213fe29e30a88c05e23d880fe479> /usr/lib/system/libsystem_info.dylib
0x39147000 - 0x39161fff libsystem_kernel.dylib armv7  <04e9aa4f30c63ff1998c1c03c1ad05ac> /usr/lib/system/libsystem_kernel.dylib
0x39162000 - 0x39182fff libsystem_m.dylib armv7  <86499a4bcb293186bd8213d5575dd22c> /usr/lib/system/libsystem_m.dylib
0x39183000 - 0x39195fff libsystem_malloc.dylib armv7  <d0158624b3b6398682dd68fb5709d25c> /usr/lib/system/libsystem_malloc.dylib
0x39196000 - 0x391c3fff libsystem_network.dylib armv7  <f93abe74828030a9b835d091b703e5b2> /usr/lib/system/libsystem_network.dylib
0x391c4000 - 0x391c9fff libsystem_networkextension.dylib armv7  <ceda56c88ed13df39d43f0667a39967a> /usr/lib/system/libsystem_networkextension.dylib
0x391ca000 - 0x391d1fff libsystem_notify.dylib armv7  <e23e38b2994238538926efe399f6a73a> /usr/lib/system/libsystem_notify.dylib
0x391d2000 - 0x391d7fff libsystem_platform.dylib armv7  <b04135119e133a9a8360ed9dd5e9c170> /usr/lib/system/libsystem_platform.dylib
0x391d8000 - 0x391defff libsystem_pthread.dylib armv7  <d352c982e1d53a7bbf3c37def4c8f314> /usr/lib/system/libsystem_pthread.dylib
0x391df000 - 0x391e1fff libsystem_sandbox.dylib armv7  <d4056efc02e83417b56b8d5258d5d2cb> /usr/lib/system/libsystem_sandbox.dylib
0x391e2000 - 0x391e5fff libsystem_stats.dylib armv7  <fa1003dfd7c43294a378371a44d518ba> /usr/lib/system/libsystem_stats.dylib
0x391e6000 - 0x391ebfff libsystem_trace.dylib armv7  <e07faea11db63c47bc6c5862a62c926a> /usr/lib/system/libsystem_trace.dylib
0x391ec000 - 0x391ecfff libunwind.dylib armv7  <057b81c42ccf3d9dbfa7fd9a35ee0dab> /usr/lib/system/libunwind.dylib
0x391ed000 - 0x39208fff libxpc.dylib armv7  <6d3e948a39bd3548aa9038575933bdef> /usr/lib/system/libxpc.dylib


Total downloads


As for the total started download, yes it's about 2000-5000 downloads (depending of the test I do and on which device I do it). But in our real app, we may have around 50 000+ files to downloads sometimes, but we wanted to throttle them over time (~100 concurrent downloads). Will it be an issue?

If you can reproduce the problem on iOS 9 beta, these crashes would make for a fine bug report. Please post your bug number, just for the record.

As for the total started download, yes it's about 2000-5000 thousands downloads

Again, I'm having trouble parsing your sentences. Read literally, "2000-5000 thousands" means 2-5 million, which is clearly not OK. I presume you mean "2-5 thousand". That should be OK, but it's obviously not in your case. Are you sure you're not 'leaking' tasks in the background session. That's easy to do and would definitely reduce the number of tasks that you could successfully execute.

But in our real app, we may have around 50 000+ files to downloads sometimes, but we wanted to throttle them over time (~100 concurrent downloads). Will it be an issue?

50,000 tasks is definitely beyond the pale. Batching them into groups of 100 should be fine.

I expect you'd be able to increase that group size and I recommend that you do because of the resume rate limiter.

Of course the best solution here would be to batch up these resources on the server send and then fetch them in one, resumable download. That would be radically more efficient, both on the network and on the client device.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

On our side, we are targeting iOS 7+, so iOS 9 is not really what we need.

For the download count, it's 2000-5000, not 2000000-5000000.

We will try to batch more than 100 and see what it does.

As for the batching server side, we have plans to do this, but it's not that soon, so we try to make it work with what we have now until we can improve it.

Hi Quinn,

I've read through this thread and the one you linked to here (https://devforums.apple.com/message/938057#938057) and I have a question about best practices to download 10,000-20,000 files via NSURLSessionDownloadTasks. (Disclaimer, i'm using AFNetworking 2.x). I'm targeting iOS 8 and newer, so answers do not have to work on iOS 7.


How can we compute a reasonable batch (group) size ? I understand the resume-rate limiter means one wants the batch size to be higher, but there's an unknown max limit of simultaneous task requests that will crash the daemon. If there's an algorithm that'd be great, otherwise even just a good constant would suffice 😉


thanks for your help!

-tim

There is no good way to download 10,000 to 20,000 individual resources. Specifically:

  • Background sessions were designed for a relatively small number of large items and you will not get acceptable result if you feed a background session this many items. If you submit them all at once,

    nsurlsessiond
    will choke; if you batch, the resume rate limiter will ruin your day.
  • Foreground sessions are rated for this sort of work, but downloading this many resources will take too long to reasonably do in a foreground session.

You really really really need to batch up this work on the server side. If you don't have control over the server, my recommendation is that you create your own server that can act as your proxy: that is, you tell this server what resources you need, it fetches them, zips them up into an archive which you download.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi, I have the same problem: my background NSURLSession stops to work with error:

domain = NSURLErrorDomain

code = -997

description = “Lost connection to background transfer service”

when I add a lot of download task (3.000+). Please let me know how I could treat that issue..

I noticed that the limit beyond which the object stops workins depends on the device I'm using for development..

Hi Quinn,

Thanks, that's a clear answer.

Unfortunately server proxying, while a neat idea, is out of my budget (I try to avoid needing servers altogether). In cases where the folder on the server has <1 GB files, I can already ask the server to zip up the folder, so the "normal" case is solved.


For the (hopefully "rare") case where there's >1 GB in the selected folder to download, I will attempt this:


Warn the user that they are going to need to keep opening the app to complete this -- give them the chance to cancel or continue.

If they continue, I'll make the first 2000 downloadTasks.

The logic in the taskDidComplete block would be simply to check if all download tasks are complete, or if the time between the last app wakeup and this wake has exceeded some threshold (say, 5 minutes).... and in either case, show a local notification to the user like "Please open the app to continue" (presuming it is not UIApplicationStateActive now)

The logic when the user then opens the app would be like this:


if ( there are still files to transfer ) {
    let n = the number of currently running download tasks
    Create up to (2000 - n) NSURLSessionDownloadTasks and resume (start) them all
}


My assumption here is that when the user opens my app and it runs for some time in the foreground, then the rate limiter is "reset" or similar -- so now things will flow nicely again. Is this assumption correct? Any other feedback on this approach?


Thanks again for your continued support. Greetings from Zürich/CH where we finally had some nice thunderstorms...

-tim

Have you tried creating more than one background session, each with only a few hundred items in it? I know that's less than ideal in terms of the complexity of managing them, but it might be worth a try.


And remember that (assuming we're talking about iOS here) your app normally restarts in the background whenever a session finishes retrieving content. You don't have to involve the user, and the user doesn't have to relaunch the app before you start a new batch of downloads. You can always handle the background completion event by scheduling another batch of downloads, repeat until you have everything, and then send the user a notification telling him/her that the download is done, allowing the user to bring the app to the foreground.

My assumption here is that when the user opens my app and it runs for some time in the foreground, then the rate limiter is "reset" or similar -- so now things will flow nicely again. Is this assumption correct?

Yes.

Also, starting with iOS 8, if the user brings your app to the front then iOS will automatically give tasks a 'kick'. I've forgotten the exact mechanics of this but I'm pretty sure it's covered in WWDC 2014 Session 707 What's New in Foundation Networking.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Have you tried creating more than one background session, each with only a few hundred items in it?

Please don't do this. Having multiple sessions make sense if the items are logically distinct, but having multiple sessions just to bypass some restriction in the OS is just starting an arms race that you're not going to win.

And remember that all sessions on the system are handled by a single instance of

nsurlsessiond
, so splitting the work between multiple sessions won't help in that regard.

You can always handle the background completion event by scheduling another batch of downloads …

Indeed, but there are limits to how far you can take this because

nsurlsessiond
limits how frequently it will resume your app. I posted a link to my old DevForums post about this earlier, but you seem to have missed the reference.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

About this answer:


Have you tried creating more than one background session, each with only a few hundred items in it?

Please don't do this. Having multiple sessions make sense if the items are logically distinct, but having multiple sessions just to bypass some restriction in the OS is just starting an arms race that you're not going to win.

And remember that all sessions on the system are handled by a single instance of

nsurlsessiond
, so splitting the work between multiple sessions won't help in that regard.

Currently I'm creating mulplitle session with a batch of 100 files in each session but resume the all of them at once, obviously checking your previous comment and this one:

Background sessions were designed for a relatively small number of large items and you will not get acceptable result if you feed a background session this many items. If you submit them all at once,

nsurlsessiond
will choke; if you batch, the resume rate limiter will ruin your day.


this way is wrong.


I want to create just one session and add all of files there (lets say 2000 files in the worst case scenario) and then resume task batch of 100 downloadTasks, firstly 100 then when they are finished another 100 and so on.


My questions is if I resume the second or the third group in a brackground state, will the discretionary propery from the NSURLSessionConfiguration be considered as YES and will it delay the downloads?

I have the same problem (or rather - can reproduce NSPOSIXErrorDomain error 2).


Simply do a NSURLSessionDataTask and:


1. Set a breakpoint where it returns (download complete is called) - debug the app and start downloading something in the bg.

2. When returning and the debugger has stopped executing the app, simply kill it (cmd-period).

3. Launchd is broken for all apps on your device until the device is restarted.


(works the same in the simulator as on real device).

bug-report id: 33094367

bug-report id: 33094367

Thanks for filing a bug report about this weird edge case.

Be aware that there are many NSURLSession background session scenarios that you can’t test from the debugger. You can find my advice on this topic in my Testing Background Session Code pinned post.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"