Assert(_asyncTaskCount >= 0) from CBLMultipartDownloader, followed by reachabilityChanged

33 views
Skip to first unread message

Tim Gogolin

unread,
May 16, 2014, 3:16:13 PM5/16/14
to mobile-c...@googlegroups.com
We're getting several crashes recently with this stack:

Thread : Fatal Exception: NSInternalInconsistencyException, via:  Assert(_asyncTaskCount >= 0);

0  CoreFoundation                 0x30082fd3 __exceptionPreprocess + 130
1  libobjc.A.dylib                0x3ac4accf objc_exception_throw + 38
2  CoreFoundation                 0x30082ead +[NSException raise:format:]
3  Foundation                     0x30a2fdb7 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 86
4  <myApp>                        0x00702b9f _AssertFailed (Test.m:348)
5  <myApp>                        0x006c8a4f -[CBL_Replicator asyncTasksFinished:] + 106
6  <myApp>                        0x006cd041 __33-[CBL_Puller pullRemoteRevision:]_block_invoke (CBL_Puller.m:431)
7  <myApp>                        0x006d5733 -[CBLRemoteRequest respondWithResult:error:] (CBLRemoteRequest.m:153)
8  <myApp>                        0x006d5885 -[CBLRemoteRequest stop] (CBLRemoteRequest.m:174)
9  CoreFoundation                 0x2fff31f5 -[NSArray makeObjectsPerformSelector:] + 300
10 <myApp>                        0x006c9f67 -[CBL_Replicator stopRemoteRequests] (CBL_Replicator.m:730)
11 <myApp>                        0x006c8457 -[CBL_Replicator goOffline] (CBL_Replicator.m:414)
12 <myApp>                        0x006cbdef -[CBL_Puller goOffline] (CBL_Puller.m:197)
13 <myApp>                        0x006c86f1 -[CBL_Replicator reachabilityChanged:] (CBL_Replicator.m:460)
14 <myApp>                        0x006c8895 -[CBL_Replicator updateActive] (CBL_Replicator.m:482)
15 <myApp>                        0x006cd041 __33-[CBL_Puller pullRemoteRevision:]_block_invoke (CBL_Puller.m:431)
16 <myApp>                        0x006d5733 -[CBLRemoteRequest respondWithResult:error:] (CBLRemoteRequest.m:153)
17 <myApp>                        0x006d6425 -[CBLRemoteRequest connection:didFailWithError:] (CBLRemoteRequest.m:369)
18 <myApp>                        0x006d5957 -[CBLRemoteRequest cancelWithStatus:] (CBLRemoteRequest.m:184)
19 <myApp>                        0x006e0efd -[CBLMultipartDownloader connection:didReceiveResponse:] (CBLMultipartDownloader.m:87)
20 Foundation                     0x309c1fc3 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 54
21 Foundation                     0x309c1f07 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 206
22 Foundation                     0x309c1e21 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
23 Foundation                     0x309c1ddf _NSURLConnectionDidReceiveResponse + 82
...
36 <myApp>                        0x006c5803 -[CBL_Server runServerThread] (CBL_Server.m:113)


What exactly is CBLMultipartDownloader? Does it relate to CBL attachments?  There should be no reason for this document to be downloading an attachment, BUT we last updated CBL April 16. The last code we got was 
b9221d0 was from Jens Alfke, April 15 "Merge branch 'master' into stable.  Which I found out today means we have a CBL bug (introduced March 31) where attachments get uploaded/downloaded more often than they need to (issue #326).

I'll try to arrange a pull of CBL in the next week, which should fix that particular bug, but am worried it would merely mask whatever crashing bug is happening in this stack, by making binary attachment transfer only happen when it actually needs to (which isn't that often for us).

Note that in all the crashlytics stacks, the percentage of crashes when the app is in the foreground is 0%.  So this is only happening when our app has been sent to the background, which I assume may help diagnose the problem...

I see that issue #336 also refers to this same assertion (_asyncTaskCount >= 0), but that stack refers to CBLMultipartUploader, followed by reachabilityChanged: whereas the crash I'm seeing is CBLMultipartDownloader followed by reachabilityChanged. I'm not sure if that makes this a different issue or the same issue.

-- Tim Gogolin
Adobe Systems Inc.

Traun Leyden

unread,
May 19, 2014, 3:22:12 PM5/19/14
to mobile-c...@googlegroups.com

 
by making binary attachment transfer only happen when it actually needs to (which isn't that often for us).

That sounds like you might be seeing this issue:


Which was recently fixed on the master branch.

Also I'm fairly certain that CBLMultipartDownloader is used even for documents without attachments.  @Jens can you confirm this?

Jens Alfke

unread,
May 22, 2014, 12:30:54 PM5/22/14
to mobile-c...@googlegroups.com

On May 19, 2014, at 12:22 PM, Traun Leyden <traun....@gmail.com> wrote:

> Also I'm fairly certain that CBLMultipartDownloader is used even for documents without attachments. @Jens can you confirm this?

Yes — the _bulk_get request returns a multipart response with one document in each part, even if the individual docs have no attachments.

—Jens
Reply all
Reply to author
Forward
0 new messages