Serious bug in iOS 11 - notification causes app to crash

Originator:lars.lindback
Number:rdar://34788843 Date Originated:
Status:Closed. Duplicate of 33765986 Resolved:
Product:iOS Product Version:iOS 11.1 beta
Classification:Bug Reproducible:Always
 
Area:
UserNotifications Framework

Summary:
Showing a notification and then putting the app in the background causes the app to crash. An assertion with the name "will present notification" forces the OS to kill the app.

Steps to Reproduce:
1. Install the test project TestCrashInBackground via Xcode on an iPhone running iOS 11.1 beta. The test project is attached to this bug report (ios-test-crash-in-background.zip).
2. Disconnect the phone from the computer.
3. Press once on the text "Schedule notification" in the TestCrashInBackground app.
4. Notification appears.
5. Click on the home button (app is now in background).
6. Lock device.
7. Wait 3 minutes.
8. Connect the iPhone to the computer again. 
9. In Xcode, go to Window->Devices And Simulators and press on View Device Logs.
10. There is now a crash file for the app TestCrashInBackground.

Expected Results:
A notification should not cause the app to crash!

Actual Results:
The app has crashed and the following info is available in the crash log:
Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace  , Code 0x8badf00d
Triggered by Thread:  0

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001853c4bc4 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001853c4a3c mach_msg + 72
2   CoreFoundation                	0x0000000185875c4c __CFRunLoopServiceMachPort + 196
3   CoreFoundation                	0x0000000185873818 __CFRunLoopRun + 1424
4   CoreFoundation                	0x0000000185793e78 CFRunLoopRunSpecific + 436
5   GraphicsServices              	0x0000000187628f84 GSEventRunModal + 100
6   UIKit                         	0x000000018f5360bc UIApplicationMain + 208
7   TestCrashInBackground         	0x0000000100e8dbac 0x100e88000 + 23468
8   libdyld.dylib                 	0x00000001852b656c start + 4

In system_logs.logarchive (from the sysdiagnose) I can see that an assertion with the name "will present notification" is added:
default	2017-10-03 14:32:16.280562 +0200	assertiond	[SpringBoard:53] Attempting to acquire assertion for TestCrashInBack:507: <BKProcessAssertion: 0x101235c90; "will present notification" (notificationAction:30s); id:…E1D79D51D1D9>
default	2017-10-03 14:32:16.281283 +0200	assertiond	[TestCrashInBack:507] Add assertion: <BKProcessAssertion: 0x101235c90; id: 53-96A5F4EA-4C42-4675-97E4-E1D79D51D1D9; name: "will present notification"; state: active; reason: notificationAction; duration: 30.0s> {
    owner = <BSProcessHandle: 0x10110a810; SpringBoard:53; valid: YES>;
    flags = preventSuspend, preventThrottleDownUI, preventIdleSleep, preventSuspendOnSleep;
}


That assertion is never removed. And eventually the app is killed:
default	2017-10-03 14:33:00.436085 +0200	assertiond	[TestCrashInBack:507] Forcing crash report with description: TestCrashInBack:507 has active assertions beyond permitted time: 
  (owner: SpringBoard:53)

Version/Build: 
iOS 11.1 beta (15B5066f)

Configuration:
Xcode Version 9.1 beta (9B37)

Comment to open radar readers: not sure how to attach a test project when creating a new open radar issue.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!