nsurlsessiond crash - due to mem issue?

Hi,

It seems that nsurlsessiond crash due to memory issue, here is the device log:

[iPhone 6s, iOS11.0)

Nov 12 16:08:42 iPhone-6s kernel[0] <Notice>: EXC_RESOURCE -> nsurlsessiond[23521] exceeded mem limit: ActiveSoft 48 MB (non-fatal)

and later...

Nov 12 16:08:42 iPhone-6s ReportCrash[23522] <Notice>: Formulating report for corpse[23521] nsurlsessiond

My session is not big - ~60 (upload) tasks, 2MB each. app was in foreground.

How can I debug this? or find a workaround.


thanks

amir.

Update:

I've receiving errors from NSURLSession didCompleteWithError :

Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={NSErrorFailingURLStringKey=<private>/upload/chunk, NSLocalizedDescription=Lost connection to background transfer service})

Replies

Nov 12 16:08:42 iPhone-6s kernel[0] <Notice>: EXC_RESOURCE -> nsurlsessiond[23521] exceeded mem limit: ActiveSoft 48 MB (non-fatal)

That’s not a crash: note the text

non-fatal
at the end. The system has generated a log for this event but it doesn’t actually crash the offending process.

My session is not big - ~60 (upload) tasks, 2MB each. app was in foreground.

nsurlsessiond
is a shared resource, used by all NSURLSession background tasks on the system. Your requirements are perfectly reasonable, so I think you should ignore this issue and move on.

Share and Enjoy

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

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

Should I ignore the following error from NSURLSession didCompleteWithError ?

Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo={NSErrorFailingURLStringKey=<private>/upload/chunk, NSLocalizedDescription=Lost connection to background transfer service})

Should I ignore the following error from NSURLSession

didCompleteWithError
?
Domain=NSURLErrorDomain Code=-997

Am I imagining things or did you add that info to your post after I responded yesterday?

Regardless, error -997 is

NSURLErrorBackgroundSessionWasDisconnected
, which is most commonly caused by
nsurlsessiond
crashing. That kinda undermines my earlier response, eh? )-:

Do you see a crash report generated for

nsurlsessiond
in this case?

Share and Enjoy

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

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

Sorry about that, as I updated my question, you were answering... amazing coincidence!


I dont see the crash report.

the device console shows:



Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus kernel[0] <Notice>: EXC_RESOURCE -> nsurlsessiond[5280] exceeded mem limit: ActiveSoft 48 MB (non-fatal)

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&9EEB5B40A67E>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Deactivate assertion: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&9EEB5B40A67E>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (deactivateAssertion): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] New process assertion state; preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep (assertion 0x104d69c10 added: (none); removed: preventIdleSleep)

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Setting jetsam priority to 10 [0x10100]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (CPUMON check): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Releasing PowerAssertion on Magisto:5275 from update

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Remove assertion: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&9EEB5B40A67E>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (CPUMON check): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: -[BKAssertion dealloc] - <0x104d69c10>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus powerd[36] <Notice>: Process assertiond.66 Released SystemIsActive "Magisto:5275:5275-6220A7D8-40C0-451D-B302-9EEB5B40A67E [Called by UIKit, from <redacted>] [0x104d69c10]" age:00:00:00 id:51539646394 [System: SysAct]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Attempting to acquire assertion for Magisto:5275: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus powerd[36] <Notice>: Sleep revert state: 1

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus powerd[36] <Notice>: Process assertiond.66 Created SystemIsActive "Magisto:5275:5275-75542B73-A302-4061-B4D0-4CA577E60A33 [Called by UIKit, from <redacted>] [0x104d69c10]" age:00:00:00 id:51539646395 [System: SysAct]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Add assertion: <BKProcessAssertion: 0x104d69c10; id: 5275-75542B73-A302-4061-B4D0-4CA577E60A33; name: "Called by UIKit, from <redacted>"; state: active; reason: finishTask; duration: 180.0s> {

owner = <BSProcessHandle: 0x104e091f0; Magisto:5275; valid: YES>;

flags = preventSuspend, preventIdleSleep, preventSuspendOnSleep;

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Activate assertion: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] New process assertion state; preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep (assertion 0x104d69c10 added: preventIdleSleep; removed: (none))

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Setting jetsam priority to 10 [0x10108]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (CPUMON check): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

<BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Creating PowerAssertion on Magisto:5275

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Created PowerAssertion on Magisto:5275, sleep reverted

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Deactivate assertion: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (deactivateAssertion): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] New process assertion state; preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep (assertion 0x104d69c10 added: (none); removed: preventIdleSleep)

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Setting jetsam priority to 10 [0x10100]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (CPUMON check): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: Releasing PowerAssertion on Magisto:5275 from update

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] Remove assertion: <BKProcessAssertion: 0x104d69c10; "Called by UIKit, from <redacted>" (finishTask:180s); id:\M-b\M^@\M-&4CA577E60A33>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: [Magisto:5275] dump all assertions HWM:5 (CPUMON check): {

<BKProcessAssertion: 0x104e4f650; "Resume" (activation:inf); id:\M-b\M^@\M-&B2980CA536FA> [active]

}

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus assertiond[66] <Notice>: -[BKAssertion dealloc] - <0x104d69c10>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus powerd[36] <Notice>: Process assertiond.66 Released SystemIsActive "Magisto:5275:5275-75542B73-A302-4061-B4D0-4CA577E60A33 [Called by UIKit, from <redacted>] [0x104d69c10]" age:00:00:00 id:51539646395 [System: SysAct]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus ReportCrash(CrashReporterSupport)[5281] <Notice>: Trying to create CR directory structure as root

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus ReportCrash(CrashReporterSupport)[5281] <Notice>: cr_update: <private>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus ReportCrash(CrashReporterSupport)[5281] <Notice>: cr_update: <private>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus nsurlsessiond(DuetActivityScheduler)[5280] <Notice>: STARTING: <private>

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus nsurlsessiond(CFNetwork)[5280] <Notice>: TIC [0x11210f830]: activity 0x1051c6d30 start handler called

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus nsurlsessiond(CFNetwork)[5280] <Notice>: TIC TCP Conn Start [4:0x11210f830]

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus nsurlsessiond(CFNetwork)[5280] <Notice>: TIC TCP Conn Connected [4:0x11210f830]: Err(16)

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus nsurlsessiond(CFNetwork)[5280] <Notice>: TIC TCP Conn Event [4:0x11210f830]: 1

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus ReportCrash[5281] <Notice>: Formulating report for corpse[5280] nsurlsessiond

Nov 12 14:18:27 iOS-Team-iPhone-6s-Plus ReportCrash(CrashReporterSupport)[5281] <Notice>: report not saved because it is non-actionable (ie: extension hangs or internal-only)



Hopefully that helps.

Sorry about that, as I updated my question, you were answering... amazing coincidence!

Quite.

report not saved because it is non-actionable (ie: extension hangs or internal-only)

This is the tricky part, because this is exactly the sort of log I’d expect to see when the system generates a non-fatal crash report.

How reproducible is this problem?

And does it reproduce if you test your app per the instructions 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"