Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure in MYBackgroundMonitor beginBackgroundTaskNamed #1368

Closed
combinatorial opened this issue Jul 18, 2016 · 4 comments
Closed

Comments

@combinatorial
Copy link
Contributor

combinatorial commented Jul 18, 2016

I am seeing a fairly common crash through monitoring our live build (#6 most common crash). It is not something I can reproduce at the moment. But here are the details I have...

This is the raw crash stack...

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x180e8adb0 __exceptionPreprocess
1  libobjc.A.dylib                0x1804eff80 objc_exception_throw
2  CoreFoundation                 0x180e8ac80 +[NSException raise:format:]
3  Foundation                     0x1818101c0 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4  Concepts                       0x100644528 _AssertFailed
5  Concepts                       0x100605b7c MYSliceReadVarUInt
6  Concepts                       0x100646f50 MYMapError
7  Concepts                       0x100646d50 MYMapError
8  CoreFoundation                 0x180e2cdfc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
9  CoreFoundation                 0x180e2c61c _CFXRegistrationPost
10 CoreFoundation                 0x180e2c39c ___CFXNotificationPost_block_invoke
11 CoreFoundation                 0x180e95414 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
12 CoreFoundation                 0x180d6a6c8 _CFXNotificationPost
13 Foundation                     0x18177280c -[NSNotificationCenter postNotificationName:object:userInfo:]
14 UIKit                          0x18628f214 __47-[UIApplication _applicationDidEnterBackground]_block_invoke
15 UIKit                          0x18635f6d4 +[UIViewController _performWithoutDeferringTransitions:]
16 UIKit                          0x18628f080 -[UIApplication _applicationDidEnterBackground]
17 UIKit                          0x18628f604 -[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]
18 UIKit                          0x18629fa80 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]
19 UIKit                          0x18628970c __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
20 UIKit                          0x186289394 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]
21 FrontBoardServices             0x18282b7ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
22 FrontBoardServices             0x18282b618 -[FBSSerialQueue _performNext]
23 FrontBoardServices             0x18282b9c8 -[FBSSerialQueue _performNextFromRunLoopSource]
24 CoreFoundation                 0x180e4109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
25 CoreFoundation                 0x180e40b30 __CFRunLoopDoSources0
26 CoreFoundation                 0x180e3e830 __CFRunLoopRun
27 CoreFoundation                 0x180d68c50 CFRunLoopRunSpecific
28 GraphicsServices               0x182650088 GSEventRunModal
29 UIKit                          0x18604a088 UIApplicationMain
30 Concepts                       0x1000e3060 main (main.m:19)
31 libdispatch.dylib              0x1809068b8 (Missing)

Crashlytics reports the exception as:

"Fatal Exception: NSInternalInconsistencyException Assertion failed: Background task already running"

Digging through the couchbase lite code this would point to this line of code being where the assertion is failing...

https://github.com/snej/MYUtilities/blob/99e03aeaafd09fd7a3c7717ee4efd33007faee02/MYBackgroundMonitor.m#L66

which is called while the app is being backgrounded...

which would be consistent with the UIApplication _applicationDidEnterBackground portion of the stack above.

It does seem that there are two places that appBackgrounding can be called...

_bgMonitor.onAppBackgrounding = ^{ [weakSelf appBackgrounding]; };

selector: @selector(appBackgrounding:)


  • Version: 1.2.1
  • Client OS: iOS 9.3.2
  • Server: sync_gateway 1.2.1
@snej
Copy link
Contributor

snej commented Jul 18, 2016

There aren't any debug symbols for CBL so the stack frames show bogus names like MYSliceReadVarUInt.

This should have been fixed in 1.2.1; see #1006.

@combinatorial
Copy link
Contributor Author

I am definitely using 1.2.1
I agree symbols are bogus which is why the exception information is important in tracking this down. Fatal Exception: NSInternalInconsistencyException Assertion failed: Background task already running

@snej
Copy link
Contributor

snej commented Jul 19, 2016

Ah, there was also #1152 which is likely what you're hitting — that's fixed in 1.3. (So is the lack of debug symbols, so if you try with the 1.3 dev preview and it still crashes, we'll at least know where...)

@combinatorial
Copy link
Contributor Author

I can confirm this is fixed with those changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants