An app that I'm working on has been experiencing a very odd crash that I am unable to reproduce and the only information I have about is it from Crashlytics. It is only happening on ios7 and googling mmapFileDeallocate returns one site where someone else was experiencing the same crash but their issue went away with an os update.
Here is the stack:
Thread : Crashed: tcpConnWorkQueue
0 libobjc.A.dylib 0x3aa00b36 objc_msgSend + 21
1 CFNetwork 0x2fece4c3 __CFURLCache::removeMMappedDataFromSet(void*) + 34
2 CFNetwork 0x2fecfa45 mmapFileDeallocate(void*, void*) + 24
3 CoreFoundation 0x3024ef5f __CFDataDeallocate + 30
4 CoreFoundation 0x301c75f7 CFRelease + 462
5 CoreFoundation 0x3023fed5 __CFArrayReleaseValues + 292
6 CoreFoundation 0x301c75f7 CFRelease + 462
7 CFNetwork 0x2fe5f1d5 __CFCachedURLResponse::~__CFCachedURLResponse() + 40
8 CFNetwork 0x2fe5f19f __CFCachedURLResponse::~__CFCachedURLResponse() + 10
9 CoreFoundation 0x301c75f7 CFRelease + 462
10 CFNetwork 0x2feaeda1 HTTPProtocol::~HTTPProtocol() + 732
11 CoreFoundation 0x301c75f7 CFRelease + 462
12 CoreFoundation 0x302b10f0 __CFBasicHashDrain + 332
13 CoreFoundation 0x301c75f7 CFRelease + 462
14 CFNetwork 0x2fe9226b SocketStream::~SocketStream() + 406
15 CFNetwork 0x2fe920c5 SocketStream::~SocketStream() + 20
16 CoreFoundation 0x301c75f7 CFRelease + 462
17 libdispatch.dylib 0x3aee8d1b _dispatch_call_block_and_release + 10
18 libdispatch.dylib 0x3aeef273 _dispatch_queue_drain$VARIANT$mp + 374
19 libdispatch.dylib 0x3aeef06b _dispatch_queue_invoke$VARIANT$mp + 42
20 libdispatch.dylib 0x3aeefce1 _dispatch_root_queue_drain + 76
21 libdispatch.dylib 0x3aeeff59 _dispatch_worker_thread2 + 56
22 libsystem_pthread.dylib 0x3b02adbf _pthread_wqthread + 298
I can post other threads at time of crash but the only one that stands out to me is AFNetworking but I haven't been able to find anything similar in their issues.
We are also seeing this reported to crashlytics and currently only happening on iOS 7 devices. When it happens, we also have an AFNetworking thread up.
From this SO thread, we found that setting the cache to zero seemed to eliminate the crash but this is not a permanent solution.
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0
diskCapacity:0
diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
We have some other NSURLCache code that we think is suspect that we are currently testing out, I will keep you updated.
UPDATE
We seemed to have resolved the issue. What we believe solved the crash was code that was clobbering the [NSURLCache sharedURLCache]
when another part of code was using it. We removed all calls that modify [NSURLCache sharedURLCache]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With