[GADPrivateUtilities removePrivateObjectForKey:] gives me EXC_BAD_ACCESS

3,036 views
Skip to first unread message

Shin-Ping

unread,
May 10, 2012, 2:13:18 PM5/10/12
to Google AdMob Ads Developers
I got these crashes when I am deallocating banner Ads and deallocating
interstitial Ads.
These problem will not happen if I am either deallocating banner Ads
or interstitial Ads.

[GADPrivateUtilities removePrivateObjectForKey:] gives me
EXC_BAD_ACCESS

- The platform that you're using
I am running on iOS simulator 5.1
- The version of the SDK you're using
I have the latest AdWhirl SDK and GoogleAdMobAds SDK version 6.0.1 or
version 6.0.4
- Any applicable logging output
see below
- Minimally reproducing code, if possible
I cannot make a simple project that demonstrate these crash. I tried
to make a simple project, but it doesn't have any problem.

Below are crash logs when I use GoogleAdMobAds SDK 6.0.4.
And if I use GoogleAdMobAds SDK 6.0.1. I will also got similar
errors.

* thread #1: tid = 0x1f03, 0x02b5833b CoreFoundation`CFHash + 43, stop
reason = EXC_BAD_ACCESS (code=1, address=0xffffffff)
frame #0: 0x02b5833b CoreFoundation`CFHash + 43
frame #1: 0x02c0abd4 CoreFoundation`__CFDictionaryStandardHashKey
+ 36
frame #2: 0x02b4d15f CoreFoundation`__CFBasicHashRehash + 1663
frame #3: 0x02b70e16 CoreFoundation`CFBasicHashRemoveValue + 2694
frame #4: 0x02b84a34 CoreFoundation`CFDictionaryRemoveValue + 228
frame #5: 0x001371bd WallpapersHD`+[GADPrivateUtilities
removePrivateObjectForKey:] + 33 at GADPrivateUtilities.m:43
frame #6: 0x001585d2 WallpapersHD`-
[GADImpressionTicketGestureRecognizer dealloc] + 45 at
GADImpressionTicketGestureRecognizer.m:60
frame #7: 0x03044e3d libobjc.A.dylib`_objc_rootRelease + 47
frame #8: 0x02b54405 CoreFoundation`CFRelease + 117
frame #9: 0x02c34a54 CoreFoundation`-[__NSArrayI dealloc] + 148
frame #10: 0x03044e3d libobjc.A.dylib`_objc_rootRelease + 47
frame #11: 0x03044e00 libobjc.A.dylib`objc_release + 48
frame #12: 0x03045c50 libobjc.A.dylib`(anonymous
namespace)::AutoreleasePoolPage::pop(void*) + 528
frame #13: 0x02b7cea8 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #14: 0x02b7f80b CoreFoundation`__CFRunLoopRun + 2011
frame #15: 0x02b7ed84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #16: 0x02b7ec9b CoreFoundation`CFRunLoopRunInMode + 123
frame #17: 0x0324c7d8 GraphicsServices`GSEventRunModal + 190
frame #18: 0x0324c88a GraphicsServices`GSEventRun + 103
frame #19: 0x00e81626 UIKit`UIApplicationMain + 1163
frame #20: 0x0002e9b6 WallpapersHD`main + 134 at main.m:14







* thread #5: WebThread
* thread #5: tid = 0x2603, 0x02b58326 CoreFoundation`CFHash + 22, stop
reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x02b58326 CoreFoundation`CFHash + 22
frame #1: 0x02c0abd4 CoreFoundation`__CFDictionaryStandardHashKey
+ 36
frame #2: 0x02b600e4 CoreFoundation`CFBasicHashFindBucket + 1572
frame #3: 0x02b5faa5 CoreFoundation`CFDictionaryGetValue + 133
frame #4: 0x001599b5 WallpapersHD`+[GADAdURLStash viewForURL:] +
62 at GADAdURLStash.m:93
frame #5: 0x001592fc WallpapersHD`+[GADMRAIDInterceptor
canInitWithRequest:] + 119 at GADMRAIDInterceptor.m:131
frame #6: 0x00b66aa8 Foundation`+
[NSURLProtocol(NSURLProtocolPrivate)
_protocolClassForRequest:allowCF:] + 219
frame #7: 0x00b66dbd Foundation`nsProtCanHandleRequest + 207
frame #8: 0x008850e7
CFNetwork`ImplAdaptor::_canHandleRequestCallback(_CFURLRequest const*,
void const*) + 31
frame #9: 0x00884f84
CFNetwork`URLProtocolRegistry::findProtocolImplForRequestAndSetIntoRequest(_CFURLRequest
const*) + 114
frame #10: 0x0088955a
CFNetwork`URLProtocolRegistry::newProtocolForRequest(__CFAllocator
const*, _CFURLRequest const*, _CFCachedURLResponse const*,
URLProtocolClient*) + 26
frame #11: 0x008894f3
CFNetwork`URLConnectionLoader::ensureLoaderHasProtocol(_CFURLRequest
const*, unsigned char, __CFDictionary const*) + 119
frame #12: 0x008893ac
CFNetwork`URLConnectionClient::_clientWillSendRequest(_CFURLRequest
const*, _CFURLResponse*,
URLConnectionClient::ClientConnectionEventQueue*) + 200
frame #13: 0x009611a7
CFNetwork`URLConnectionClient::startConnection() + 215
frame #14: 0x0088896c CFNetwork`URLConnection::start() + 26
frame #15: 0x0088894d CFNetwork`CFURLConnectionStart + 26
frame #16: 0x04c2efa7
WebCore`WebCore::ResourceHandle::start(WebCore::NetworkingContext*) +
225
frame #17: 0x04c2b6d0
WebCore`WebCore::ResourceHandle::create(WebCore::NetworkingContext*,
WebCore::ResourceRequest const&, WebCore::ResourceHandleClient*, bool,
bool) + 94
frame #18: 0x04c30833 WebCore`WebCore::ResourceLoader::start() +
209
frame #19: 0x04cafe5e
WebCore`WebCore::SubresourceLoader::startLoading() + 170
frame #20: 0x04c32c20
WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadScheduler::HostInformation*,
WebCore::ResourceLoadPriority) + 296
frame #21: 0x04c331bd
WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoader*,
WebCore::ResourceLoadPriority) + 397
frame #22: 0x04c3333b
WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Frame*,
WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
bool, WTF::String const&, bool) + 117
frame #23: 0x04396642
WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader*,
WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
1036
frame #24: 0x043915e2
WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
bool, WebCore::SecurityCheckPolicy, bool) + 58
frame #25: 0x04390ad8
WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
+ 56
frame #26: 0x043922c6
WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource::Type,
WebCore::KURL const&, WTF::String const&,
WebCore::ResourceLoadPriority) + 90
frame #27: 0x04392a05
WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResource::Type,
WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
bool) + 569
frame #28: 0x043934a9
WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
const&, WTF::String const&) + 55
frame #29: 0x04c52ae1
WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
151
frame #30: 0x04c52ddd
WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBasedNumber>
const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
frame #31: 0x04695e6d
WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
frame #32: 0x04696909
WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>,
WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
frame #33: 0x046485ff
WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
+ 99
frame #34: 0x046486f1
WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode,
WebCore::PumpSession&) + 87
frame #35: 0x046488c8
WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
+ 290
frame #36: 0x04648a50
WebCore`WebCore::HTMLDocumentParser::resumeParsingAfterYield() + 34
frame #37: 0x046921c6
WebCore`WebCore::HTMLParserScheduler::continueNextChunkTimerFired(WebCore::Timer<WebCore::HTMLParserScheduler>*)
+ 82
frame #38: 0x04692307
WebCore`WebCore::Timer<WebCore::HTMLParserScheduler>::fired() + 43
frame #39: 0x04d4cc68
WebCore`WebCore::ThreadTimers::sharedTimerFiredInternal() + 140
frame #40: 0x04d4cbd6
WebCore`WebCore::ThreadTimers::sharedTimerFired() + 22
frame #41: 0x04c7a6c0
WebCore`_ZN7WebCoreL10timerFiredEP16__CFRunLoopTimerPv + 64
frame #42: 0x02c1c936
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
+ 22
frame #43: 0x02c1c3d7 CoreFoundation`__CFRunLoopDoTimer + 551
frame #44: 0x02b7f790 CoreFoundation`__CFRunLoopRun + 1888
frame #45: 0x02b7ed84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #46: 0x02b7ec9b CoreFoundation`CFRunLoopRunInMode + 123
frame #47: 0x04d85420 WebCore`_ZL12RunWebThreadPv + 560
frame #48: 0x97552ed9 libsystem_c.dylib`_pthread_start + 335
* thread #5: tid = 0x2603, 0x02b58326 CoreFoundation`CFHash + 22, stop
reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x02b58326 CoreFoundation`CFHash + 22
frame #1: 0x02c0abd4 CoreFoundation`__CFDictionaryStandardHashKey
+ 36
frame #2: 0x02b600e4 CoreFoundation`CFBasicHashFindBucket + 1572
frame #3: 0x02b5faa5 CoreFoundation`CFDictionaryGetValue + 133
frame #4: 0x001599b5 WallpapersHD`+[GADAdURLStash viewForURL:] +
62 at GADAdURLStash.m:93
frame #5: 0x001592fc WallpapersHD`+[GADMRAIDInterceptor
canInitWithRequest:] + 119 at GADMRAIDInterceptor.m:131
frame #6: 0x00b66aa8 Foundation`+
[NSURLProtocol(NSURLProtocolPrivate)
_protocolClassForRequest:allowCF:] + 219
frame #7: 0x00b66dbd Foundation`nsProtCanHandleRequest + 207
frame #8: 0x008850e7
CFNetwork`ImplAdaptor::_canHandleRequestCallback(_CFURLRequest const*,
void const*) + 31
frame #9: 0x00884f84
CFNetwork`URLProtocolRegistry::findProtocolImplForRequestAndSetIntoRequest(_CFURLRequest
const*) + 114
frame #10: 0x0088955a
CFNetwork`URLProtocolRegistry::newProtocolForRequest(__CFAllocator
const*, _CFURLRequest const*, _CFCachedURLResponse const*,
URLProtocolClient*) + 26
frame #11: 0x008894f3
CFNetwork`URLConnectionLoader::ensureLoaderHasProtocol(_CFURLRequest
const*, unsigned char, __CFDictionary const*) + 119
frame #12: 0x008893ac
CFNetwork`URLConnectionClient::_clientWillSendRequest(_CFURLRequest
const*, _CFURLResponse*,
URLConnectionClient::ClientConnectionEventQueue*) + 200
frame #13: 0x009611a7
CFNetwork`URLConnectionClient::startConnection() + 215
frame #14: 0x0088896c CFNetwork`URLConnection::start() + 26
frame #15: 0x0088894d CFNetwork`CFURLConnectionStart + 26
frame #16: 0x04c2efa7
WebCore`WebCore::ResourceHandle::start(WebCore::NetworkingContext*) +
225
frame #17: 0x04c2b6d0
WebCore`WebCore::ResourceHandle::create(WebCore::NetworkingContext*,
WebCore::ResourceRequest const&, WebCore::ResourceHandleClient*, bool,
bool) + 94
frame #18: 0x04c30833 WebCore`WebCore::ResourceLoader::start() +
209
frame #19: 0x04cafe5e
WebCore`WebCore::SubresourceLoader::startLoading() + 170
frame #20: 0x04c32c20
WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadScheduler::HostInformation*,
WebCore::ResourceLoadPriority) + 296
frame #21: 0x04c331bd
WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoader*,
WebCore::ResourceLoadPriority) + 397
frame #22: 0x04c3333b
WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Frame*,
WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
bool, WTF::String const&, bool) + 117
frame #23: 0x04396642
WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader*,
WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
1036
frame #24: 0x043915e2
WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
bool, WebCore::SecurityCheckPolicy, bool) + 58
frame #25: 0x04390ad8
WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
+ 56
frame #26: 0x043922c6
WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource::Type,
WebCore::KURL const&, WTF::String const&,
WebCore::ResourceLoadPriority) + 90
frame #27: 0x04392a05
WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResource::Type,
WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
bool) + 569
frame #28: 0x043934a9
WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
const&, WTF::String const&) + 55
frame #29: 0x04c52ae1
WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
151
frame #30: 0x04c52ddd
WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBasedNumber>
const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
frame #31: 0x04695e6d
WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
frame #32: 0x04696909
WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element>,
WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
frame #33: 0x046485ff
WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
+ 99
frame #34: 0x046486f1
WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode,
WebCore::PumpSession&) + 87
frame #35: 0x046488c8
WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
+ 290
frame #36: 0x04648a50
WebCore`WebCore::HTMLDocumentParser::resumeParsingAfterYield() + 34
frame #37: 0x046921c6
WebCore`WebCore::HTMLParserScheduler::continueNextChunkTimerFired(WebCore::Timer<WebCore::HTMLParserScheduler>*)
+ 82
frame #38: 0x04692307
WebCore`WebCore::Timer<WebCore::HTMLParserScheduler>::fired() + 43
frame #39: 0x04d4cc68
WebCore`WebCore::ThreadTimers::sharedTimerFiredInternal() + 140
frame #40: 0x04d4cbd6
WebCore`WebCore::ThreadTimers::sharedTimerFired() + 22
frame #41: 0x04c7a6c0
WebCore`_ZN7WebCoreL10timerFiredEP16__CFRunLoopTimerPv + 64
frame #42: 0x02c1c936
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
+ 22
frame #43: 0x02c1c3d7 CoreFoundation`__CFRunLoopDoTimer + 551
frame #44: 0x02b7f790 CoreFoundation`__CFRunLoopRun + 1888
frame #45: 0x02b7ed84 CoreFoundation`CFRunLoopRunSpecific + 212
frame #46: 0x02b7ec9b CoreFoundation`CFRunLoopRunInMode + 123
frame #47: 0x04d85420 WebCore`_ZL12RunWebThreadPv + 560
frame #48: 0x97552ed9 libsystem_c.dylib`_pthread_start + 335

jfieres

unread,
May 12, 2012, 9:54:04 AM5/12/12
to Google AdMob Ads Developers
Addendum:
If I remember right I had this error in the following scenario.

- A GADBAnnerView was scheduled for release (using NSTimer)
- App was closed (sent to background) before the NSTimer had fired
- App was brought to foreground. --> Crash.

After the last step, the timer must have fired instantaneously, thus
releasing the GADBAnnerView.

@Google: Does the SDK anything with its GADBAnnerViews when the app is
brought to the foreground which could interfere with releasing?

In my banner views I have auto-refresh turned off, so I don't think an
auto-refresh was triggered.

--Johannes
> WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::Resou rceLoadScheduler::HostInformation*,
> WebCore::ResourceLoadPriority) + 296
>     frame #21: 0x04c331bd
> WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoade r*,
> WebCore::ResourceLoadPriority) + 397
>     frame #22: 0x04c3333b
> WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Fr ame*,
> WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
> WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
> bool, WTF::String const&, bool) + 117
>     frame #23: 0x04396642
> WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader* ,
> WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
> 1036
>     frame #24: 0x043915e2
> WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
> bool, WebCore::SecurityCheckPolicy, bool) + 58
>     frame #25: 0x04390ad8
> WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
> + 56
>     frame #26: 0x043922c6
> WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource ::Type,
> WebCore::KURL const&, WTF::String const&,
> WebCore::ResourceLoadPriority) + 90
>     frame #27: 0x04392a05
> WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResou rce::Type,
> WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
> bool) + 569
>     frame #28: 0x043934a9
> WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
> const&, WTF::String const&) + 55
>     frame #29: 0x04c52ae1
> WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
> 151
>     frame #30: 0x04c52ddd
> WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBas edNumber>
> const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
>     frame #31: 0x04695e6d
> WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
>     frame #32: 0x04696909
> WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element >,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
>     frame #33: 0x046485ff
> WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
> + 99
>     frame #34: 0x046486f1
> WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocument Parser::SynchronousMode,
> WebCore::PumpSession&) + 87
>     frame #35: 0x046488c8
> WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentPar ser::SynchronousMode)
> WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::Resou rceLoadScheduler::HostInformation*,
> WebCore::ResourceLoadPriority) + 296
>     frame #21: 0x04c331bd
> WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoade r*,
> WebCore::ResourceLoadPriority) + 397
>     frame #22: 0x04c3333b
> WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Fr ame*,
> WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
> WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
> bool, WTF::String const&, bool) + 117
>     frame #23: 0x04396642
> WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader* ,
> WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
> 1036
>     frame #24: 0x043915e2
> WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
> bool, WebCore::SecurityCheckPolicy, bool) + 58
>     frame #25: 0x04390ad8
> WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
> + 56
>     frame #26: 0x043922c6
> WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource ::Type,
> WebCore::KURL const&, WTF::String const&,
> WebCore::ResourceLoadPriority) + 90
>     frame #27: 0x04392a05
> WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResou rce::Type,
> WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
> bool) + 569
>     frame #28: 0x043934a9
> WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
> const&, WTF::String const&) + 55
>     frame #29: 0x04c52ae1
> WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
> 151
>     frame #30: 0x04c52ddd
> WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBas edNumber>
> const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
>     frame #31: 0x04695e6d
> WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
>     frame #32: 0x04696909
> WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element >,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
>     frame #33: 0x046485ff
> WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
> + 99
>     frame #34: 0x046486f1
> WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocument Parser::SynchronousMode,
> WebCore::PumpSession&) + 87
>     frame #35: 0x046488c8
> WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentPar ser::SynchronousMode)

jfieres

unread,
May 12, 2012, 8:49:45 AM5/12/12
to Google AdMob Ads Developers
Hi,

I have seen the same problem in iOS SDK 6.0.1.

I think it might be related to releasing banner views when they are
not needed any more. Do you release banner views in your code?
The docs say: Don't directly release banner views in any
GADBannerDelegate function, use autorelease instead. To be extra safe,
I use a NSTimer to defer the release for 10 seconds.
I still have seen the above error in SDK 6.0.1.

Johannes

On May 10, 8:13 pm, Shin-Ping <lightboy...@gmail.com> wrote:
> WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::Resou rceLoadScheduler::HostInformation*,
> WebCore::ResourceLoadPriority) + 296
>     frame #21: 0x04c331bd
> WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoade r*,
> WebCore::ResourceLoadPriority) + 397
>     frame #22: 0x04c3333b
> WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Fr ame*,
> WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
> WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
> bool, WTF::String const&, bool) + 117
>     frame #23: 0x04396642
> WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader* ,
> WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
> 1036
>     frame #24: 0x043915e2
> WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
> bool, WebCore::SecurityCheckPolicy, bool) + 58
>     frame #25: 0x04390ad8
> WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
> + 56
>     frame #26: 0x043922c6
> WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource ::Type,
> WebCore::KURL const&, WTF::String const&,
> WebCore::ResourceLoadPriority) + 90
>     frame #27: 0x04392a05
> WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResou rce::Type,
> WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
> bool) + 569
>     frame #28: 0x043934a9
> WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
> const&, WTF::String const&) + 55
>     frame #29: 0x04c52ae1
> WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
> 151
>     frame #30: 0x04c52ddd
> WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBas edNumber>
> const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
>     frame #31: 0x04695e6d
> WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
>     frame #32: 0x04696909
> WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element >,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
>     frame #33: 0x046485ff
> WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
> + 99
>     frame #34: 0x046486f1
> WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocument Parser::SynchronousMode,
> WebCore::PumpSession&) + 87
>     frame #35: 0x046488c8
> WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentPar ser::SynchronousMode)
> WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::Resou rceLoadScheduler::HostInformation*,
> WebCore::ResourceLoadPriority) + 296
>     frame #21: 0x04c331bd
> WebCore`WebCore::ResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoade r*,
> WebCore::ResourceLoadPriority) + 397
>     frame #22: 0x04c3333b
> WebCore`WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Fr ame*,
> WebCore::SubresourceLoaderClient*, WebCore::ResourceRequest const&,
> WebCore::ResourceLoadPriority, WebCore::SecurityCheckPolicy, bool,
> bool, WTF::String const&, bool) + 117
>     frame #23: 0x04396642
> WebCore`WebCore::CachedResourceRequest::load(WebCore::CachedResourceLoader* ,
> WebCore::CachedResource*, bool, WebCore::SecurityCheckPolicy, bool) +
> 1036
>     frame #24: 0x043915e2
> WebCore`WebCore::CachedResourceLoader::load(WebCore::CachedResource*,
> bool, WebCore::SecurityCheckPolicy, bool) + 58
>     frame #25: 0x04390ad8
> WebCore`WebCore::CachedResource::load(WebCore::CachedResourceLoader*)
> + 56
>     frame #26: 0x043922c6
> WebCore`WebCore::CachedResourceLoader::loadResource(WebCore::CachedResource ::Type,
> WebCore::KURL const&, WTF::String const&,
> WebCore::ResourceLoadPriority) + 90
>     frame #27: 0x04392a05
> WebCore`WebCore::CachedResourceLoader::requestResource(WebCore::CachedResou rce::Type,
> WTF::String const&, WTF::String const&, WebCore::ResourceLoadPriority,
> bool) + 569
>     frame #28: 0x043934a9
> WebCore`WebCore::CachedResourceLoader::requestScript(WTF::String
> const&, WTF::String const&) + 55
>     frame #29: 0x04c52ae1
> WebCore`WebCore::ScriptElement::requestScript(WTF::String const&) +
> 151
>     frame #30: 0x04c52ddd
> WebCore`WebCore::ScriptElement::prepareScript(WTF::TextPosition<WTF::OneBas edNumber>
> const&, WebCore::ScriptElement::LegacyTypeSupport) + 585
>     frame #31: 0x04695e6d
> WebCore`WebCore::HTMLScriptRunner::runScript(WebCore::Element*,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 91
>     frame #32: 0x04696909
> WebCore`WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr<WebCore::Element >,
> WTF::TextPosition<WTF::OneBasedNumber> const&) + 49
>     frame #33: 0x046485ff
> WebCore`WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
> + 99
>     frame #34: 0x046486f1
> WebCore`WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocument Parser::SynchronousMode,
> WebCore::PumpSession&) + 87
>     frame #35: 0x046488c8
> WebCore`WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentPar ser::SynchronousMode)

Raj Parameswaran

unread,
May 14, 2012, 4:42:03 PM5/14/12
to Google AdMob Ads Developers
Hey,

I don't think the SDK does anything special when the app is
foregrounded that could interfere with its releasing. There should
just be logic for starting up the refresh cycle again (which you
wouldn't have since you turned off auto refresh).

I created an app following your guidelines (timer to release the
banner when it comes into the foreground) but as you said I seem to be
having a hard time reproducing it here.

I know you said you can't reproduce the error on its own project, but
can you post some snippets of your code showing where you're setting
up your timer and your release code? Any code that shows what you're
doing in relation to your ads when your app is backgrounded/
foregrounded would be awesome as well.
> ...
>
> read more »

Raj Parameswaran

unread,
May 15, 2012, 12:00:38 AM5/15/12
to Google AdMob Ads Developers
This actually looks very similar to an issue we may have fixed in the
latest SDK as well. Can you double check which version of the SDK
you're linking against? You can log a [GADRequest sdkVersion] to check
easily.
> ...
>
> read more »

Shin-Ping

unread,
May 15, 2012, 2:12:11 PM5/15/12
to Google AdMob Ads Developers
I found a hint to help me reproducing one of the crash.

* thread #5: WebThread
* thread #5: tid = 0x2603, 0x02b58326 CoreFoundation`CFHash + 22,
stop
reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x02b58326 CoreFoundation`CFHash + 22
frame #1: 0x02c0abd4 CoreFoundation`__CFDictionaryStandardHashKey
+ 36
frame #2: 0x02b600e4 CoreFoundation`CFBasicHashFindBucket + 1572
frame #3: 0x02b5faa5 CoreFoundation`CFDictionaryGetValue + 133
frame #4: 0x001599b5 WallpapersHD`+[GADAdURLStash viewForURL:] +
62 at GADAdURLStash.m:93

I reproduce this issue when I dealloc GADBanner and then try to
display an InMobi Interstitial.
I have to use an old version of InMobi SDK. I cannot reproduce this
issue if I am using the newest InMobi SDK.

I upload a demo project in github.

https://github.com/shinping/AdMob_SDK_604_crash
> > > >     frame #36: 0x04648a50...
>
> read more »
Message has been deleted

Rajkumar Parameswaran

unread,
May 16, 2012, 2:29:31 PM5/16/12
to google-adm...@googlegroups.com
Hey,

So I downloaded your first project and was able to reproduce the MRaidInterceptor crash. Our engineers are looking at this now to determine why it's happening. 

However, when I try to download your repo today it's 404'ing, so I'm thinking you may have possibly made this a private repo? (In which case I can't access it). You could send up a zipped project to my email address if you'd like as well.

On Tue, May 15, 2012 at 6:04 PM, Shin-Ping <light...@gmail.com> wrote:
I upload a demo project in github.  And I added a branch while I am
trying to reproduce the issue.  See the stack trace at the end of this
post.
This issue happens after I autorelease GADInterstitial object.

If you want to see some snippets, please clone this git repository.  I
do not use timer to release object.
https://github.com/shinping/AdMob_SDK_604_crash
then git checkout this branch, adMobInterstitial603.
Do not checkout master branch.  The master branch doesn't display
GADInterstitial.

>>
Here is the stack trace.  I guess this project can be solved if you
look at (GADPrivateUtilities.m:43)
SDK version is 6.0.3

I can reproduce this issue once a day.
It happens on version 6.0.1 and 6.0.3.  It will probably happen on
version 6.0.4.  It happens more often on version 6.0.1.
But this issue doesn't happen in my short demo project.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xffffffff
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                      0x35c73e58 CFHash + 20
1   CoreFoundation                      0x35cefbe0
__CFDictionaryStandardHashKey + 16
2   CoreFoundation                      0x35d40d70 __CFBasicHashRehash +
1828
3   CoreFoundation                      0x35d432a8 __CFBasicHashRemoveValue
+ 516
4   CoreFoundation                      0x35c777e4 CFBasicHashRemoveValue +
2900
5   CoreFoundation                      0x35c76c60 CFDictionaryRemoveValue
+ 172
6   WallpapersHD                        0x000db300 +[GADPrivateUtilities
removePrivateObjectForKey:] (GADPrivateUtilities.m:43)
7   WallpapersHD                        0x000f70b4 -
[GADImpressionTicketGestureRecognizer dealloc]
(GADImpressionTicketGestureRecognizer.m:60)
8   libobjc.A.dylib                     0x3169f16e _objc_rootRelease + 30
9   CoreFoundation                      0x35c732e0 CFRelease + 88
10  CoreFoundation                      0x35c806f4 -[__NSArrayI dealloc] +
96
11  libobjc.A.dylib                     0x3169f16e _objc_rootRelease + 30
12  libobjc.A.dylib                     0x316a0e50 objc_release + 32
13  libobjc.A.dylib                     0x3169fea6 (anonymous
namespace)::AutoreleasePoolPage::pop(void*) + 218
14  libobjc.A.dylib                     0x3169fdc2 _objc_autoreleasePoolPop
+ 6
15  CoreFoundation                      0x35c7acf8 _CFAutoreleasePoolPop +
12
16  CoreFoundation                      0x35cfd2ac __CFRunLoopRun + 1268
17  CoreFoundation                      0x35c8049e CFRunLoopRunSpecific +
294
18  CoreFoundation                      0x35c80366 CFRunLoopRunInMode + 98
19  GraphicsServices                    0x359ff432 GSEventRunModal + 130
20  UIKit                               0x3085be76 UIApplicationMain + 1074
21  WallpapersHD                        0x000239d4 main (main.m:14)
22  WallpapersHD                        0x00003648 start + 32

Brandon

unread,
May 20, 2012, 1:38:07 PM5/20/12
to Google AdMob Ads Developers
Hey,
 This issue is blocking my implementation of your iOS SDK, as well.
It's easily triggered/reproducible by attempting to load an MRAID ad
(some HTML that starts with "<script src='mraid.js'></script>") into
any UIWebView while a GADBannerView is running.

Brandon

unread,
May 18, 2012, 1:16:48 PM5/18/12
to Google AdMob Ads Developers
Is there any progress on the MRaidInterceptor crash?

On May 16, 8:29 pm, Rajkumar Parameswaran <rajp...@google.com> wrote:

Brandon

unread,
May 22, 2012, 9:24:59 AM5/22/12
to google-adm...@googlegroups.com

Hey, I hope there's some progress on this - you can reproduce the crash with this in a vc:

- (void)viewDidLoad

{

    [super viewDidLoad];

// Bring the ad.

    

    // Create a view of the standard size at the bottom of the screen.

    // Available AdSize constants are explained in GADAdSize.h.

    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

    

    // Specify the ad's "unit identifier." This is your AdMob Publisher ID.

    bannerView_.adUnitID = @"somebullshit";

    

    // Let the runtime know which UIViewController to restore after taking

    // the user wherever the ad goes and add it to the view hierarchy.

    bannerView_.rootViewController = self;

    [self.view addSubview:bannerView_];

    

    // Initiate a generic request to load it with an ad.

    [bannerView_ loadRequest:[GADRequest request]];

// Bring the fail.

NSString *mraidString = @"\

    <html>\

    <script src='mraid.js'></script>\

    <script>\

(function() {\

var r = Math.floor(Math.random()*1000000);\

var u = 'http://www.some.link/ad.js?rnd='+r;\

document.write('<script src='+u+'></scr'+'ipt>');\

})()\

    </script>\

    </html>\

    ";

    webView_ = [[UIWebView alloc] initWithFrame:CGRectMake(200, 200, 250, 50)];

    [self.view addSubview:webView_];

    [webView_ loadHTMLString:mraidString baseURL:nil];

Rajkumar Parameswaran

unread,
May 22, 2012, 12:59:27 PM5/22/12
to google-adm...@googlegroups.com
Hey Brandon,

Thanks for the reproducing code, our engineers are looking into the issue right now. In the meantime, are you seeing this crash in production? My understanding was that there are very few mraid ads being trafficked currently, so this crash shouldn't stop you from developing, unless you're actually trying to use mraid.js for some reason?

Rajkumar Parameswaran

unread,
Jul 28, 2012, 4:42:52 PM7/28/12
to google-adm...@googlegroups.com
Are you still seeing this crash on 6.1.1/2? This update should have fixed this crash.

On Fri, Jul 20, 2012 at 6:31 PM, Wei <weig...@gmail.com> wrote:
I am also experiencing this crash, and I'd like to hightlight two things I noticed with AdMob that the crash stems from.

1. AdMob is "wire tapping" every single URL request made by the client app, even the ones that do not belong to AdMob. Put a symbolic break point "-[NSURLProtocol registerClass:]", and you will see a GADMRAIDInterceptor registers itself to NSURLProtocol to get the first dibs on deciding on whether to handle every URL request with a call stack below. This means, UNLESS you register some other class to NSURLProtocol later, AdMob will always be the first one to see and analyze your URL requests before you get a chance to! My guess is that most people like me probably don't realize this until AdMob SDK crashes and starts looking into what AdMob is really doing. Would you want your URL requests, in some context, sensitive ones to be intercepted by a 3rd party SDK? Probably not.

#0    0x00df4f22 in +[NSURLProtocol registerClass:] ()
#1    0x000284eb in +[GADMRAIDInterceptor allow]
#2    0x00025c85 in -[GADJavaScriptController loadSdkConstants:]
#3    0x00e75a39 in __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 ()
#4    0x018b9885 in ___CFXNotificationPost_block_invoke_0 ()
#5    0x018b97a8 in _CFXNotificationPost ()
#6    0x00dba1aa in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#7    0x00014e66 in -[GADNotificationCenter postNotificationFromURL:object:]
#8    0x00014ed5 in -[GADNotificationCenter delayedPosting:]

2. Following 1, this is where the crash comes in. Since AdMob wire taps all URL requests with GADMRAIDInterceptor registered to NSURLProtocol, [GADMRAIDInterceptor canInitWithRequest:] is invoked as the first callback for every URL request. If the URL request passed into this call back is created from a javascript file named "mraid.js", AdMob bound to crash due to referencing some object already deallocated with the call stack below. If the javascript file is named something else than "mraid.js", AdMob does not crash. There is some special logic revolving around "mraid.js" when AdMob wire tap any URL request?

#4    0x00028e89 in +[GADAdURLStash viewForURL:]  EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
#5    0x000287d0 in +[GADMRAIDInterceptor canInitWithRequest:]
#6    0x00df6ab8 in +[NSURLProtocol(NSURLProtocolPrivate) _protocolClassForRequest:allowCF:] ()
#7    0x00df6dcd in nsProtCanHandleRequest ()
#8    0x044cb261 in ImplAdaptor::_canHandleRequestCallback(_CFURLRequest const*, void const*) ()
#9    0x044cb0fe in URLProtocolRegistry::findProtocolImplForRequestAndSetIntoRequest(_CFURLRequest const*) ()
#10    0x044cd2f0 in URLProtocolRegistry::bindImplementationForFoundation(_CFURLRequest const*) ()
#11    0x044cd2c8 in _CFURLProtocolBindImplementationForFoundation ()
#12    0x00df8aff in createCFRequest ()
#13    0x00eb54f2 in -[NSURLConnectionInternalConnection initWithInfo:] ()
#14    0x00eb40af in -[NSURLConnection(Private) _initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:] ()
#15    0x00eb41f6 in -[NSURLConnection initWithRequest:delegate:] ()
#16    0x00eb417b in +[NSURLConnection connectionWithRequest:delegate:] ()

The crash can be easily produced with these steps:
1. Add any javascript named "mraid.js" to your project. Make sure it appears in "Copy bundle resource" in your target.
2. Load an AdMob banner ad. After AdMob register its class to NSURLProtocol to intercept all URL, create a URL with the javascript file, and issue a request with this URL.

This is my simple view controller code to illustrate the crash by loading an AdMob banner view, tapping the home button, and going back to the app.

#import "ViewController.h"
#import "GADBannerView.h"

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
   
    GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

    bannerView.adUnitID = @"replace with your AdUnitID";
    bannerView.rootViewController = self;
   
    GADRequest *request = [[GADRequest alloc] init];
    [bannerView loadRequest:request];
   
    [self.view addSubview:bannerView];
   
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomething:) name:UIApplicationDidBecomeActiveNotification object:nil];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (void)doSomething:(id)sender {
    // Get my mraid javascript
    NSString* myMraidPath = [[NSBundle mainBundle] pathForResource:@"mraid" ofType:@"js"];
   
    // Create my URL with my javascript
    NSURL *myURL = [NSURL fileURLWithPath:myMraidPath];
   
    // Create and issue my URL request
    NSURLRequest *myURLRequest = [NSURLRequest requestWithURL:myURL];
    [NSURLConnection connectionWithRequest:myURLRequest delegate:self];
--
 
 
 

Rajkumar Parameswaran

unread,
Sep 27, 2012, 12:45:41 PM9/27/12
to google-adm...@googlegroups.com
Hey Evan,

Is there some reason you can't add some type of synchronization logic here so that AdMob only requests an ad either before or after your async NSURLRequests are complete?

If that's not the case, would you happen to have a small test app that reproduces the problem? I'm interested to see if we can perhaps come up with another workaround here. 

Raj

On Mon, Sep 24, 2012 at 1:34 PM, Evan <evan....@bottlerocketapps.com> wrote:

What appears to be happening is while firing a few simultaneous async NSURLRequests, we occasionally get a crash when we're also trying to load an ad through AdMob. We believe the cause of this to be AdMob registering GADMRAIDInterceptor to NSURLProtocol while another thread is enumerating the Protocols. 


We are running AdMob iOS SDK 6.1.4, and experiencing this on iOS 6.0 on iPad 2 and the new iPad. 


Here's the console message from the crash: 

*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x1e57fcb0> was mutated while being enumerated.' 


and the crash log: 

Thread 14 Crashed:

0   libsystem_kernel.dylib         0x3a52d350 __pthread_kill + 8

1   libsystem_c.dylib             0x35a7a11e pthread_kill + 54

2   libsystem_c.dylib             0x35ab696e abort + 90

3   libc++abi.dylib               0x36b6fd4a abort_message + 70

4   libc++abi.dylib               0x36b6cff4 default_terminate() + 20

5   libobjc.A.dylib               0x3a404a74 _objc_terminate() + 144

6   libc++abi.dylib               0x36b6d078 safe_handler_caller(void (*)()) + 76

7   libc++abi.dylib               0x36b6d110 std::terminate() + 16

8   libc++abi.dylib               0x36b6e50e __cxa_throw + 118

9   libobjc.A.dylib               0x3a4049ba objc_exception_throw + 90

10  CoreFoundation                 0x384ccd80 __NSFastEnumerationMutationHandler + 124

11  Foundation                     0x3623e358 +[NSURLProtocol(NSURLProtocolPrivate) _protocolClassForRequest:allowCF:] + 168

12  Foundation                     0x3623e276 nsProtCanHandleRequest + 182

13  CFNetwork                     0x3812839c ImplAdaptor::_canHandleRequestCallback(_CFURLRequest const*, void const*) + 20

14  CFNetwork                     0x381282e0 URLProtocolRegistry::findProtocolImplForRequestAndSetIntoRequest(_CFURLRequest const*) + 72

15  CFNetwork                     0x38174b90 URLProtocolRegistry::newProtocolForRequest(__CFAllocator const*, _CFURLRequest const*, URLProtocolClient*) + 16

16  CFNetwork                     0x3819fcae URLConnectionLoader::ensureLoaderHasProtocolNoLock(_CFURLRequest const*) + 338

17  CFNetwork                     0x381a0072 URLConnectionLoader::createProtocolAndCopyCanonicalRequestBeforeLoadHasStarted(_CFURLRequest const*) + 6

18  CFNetwork                     0x3819b170 URLConnectionClient::_internalEvent_WillSendRequest() + 52

19  CFNetwork                     0x38173900 __start_block_invoke_0 + 36

20  CFNetwork                     0x381742f0 ___withClientAsync_block_invoke_0 + 20

21  CFNetwork                     0x3819a5b6 ___withWorkQueueAsync_block_invoke_0 + 10

22  CFNetwork                     0x381c4f9c ___performAsync_block_invoke_0 + 24

23  libdispatch.dylib             0x35cec11c _dispatch_call_block_and_release + 8

24  libdispatch.dylib             0x35cefeca _dispatch_queue_drain$VARIANT$mp + 138

25  libdispatch.dylib             0x35cefdbc _dispatch_queue_invoke$VARIANT$mp + 36

26  libdispatch.dylib             0x35cf091a _dispatch_root_queue_drain + 182

27  libdispatch.dylib             0x35cf0abc _dispatch_worker_thread2 + 80

28  libsystem_c.dylib             0x35a51a0e _pthread_wqthread + 358

29  libsystem_c.dylib             0x35a518a0 start_wqthread + 4

--
 
 
 

Paul Falstad

unread,
Oct 3, 2012, 12:34:35 PM10/3/12
to google-adm...@googlegroups.com
I'm seeing this same crash in my app, but my app does not make any NSURLRequests.

Rajkumar Parameswaran

unread,
Oct 4, 2012, 8:42:01 PM10/4/12
to google-adm...@googlegroups.com
You're seeing this crash on the v6.2? Do you have more details about your setup (i.e version of iOS, device or simulator, etc.). Are you able to reproduce the crash consistently?

--
 
 
 

Angela

unread,
Oct 6, 2012, 1:23:40 AM10/6/12
to google-adm...@googlegroups.com
WHY DO I KEEP GETTING THESE FUCKING EMAILS????
----- Original Message -----
From: Todd Huss
Sent: Friday, October 05, 2012 8:09 AM
Subject: Re: gives me EXC_BAD_ACCESS

We gets lots of these crashes in our app too, would be great if google would fix this!
--
 
 
 

Shin-Ping

unread,
Oct 15, 2012, 10:21:09 PM10/15/12
to google-adm...@googlegroups.com

I also saw a lot of this crash.  

I cannot reproduce this issue consistently.  It happens rarely.

It crash when I restart the app.  I was making requests that are not related to AdMob.  

I saw this issue on iOS 6 iPhone device and simulator. 


*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0xa471140> was mutated while being enumerated.'


(lldb) po 0xa471140

(int) $1 = 172429632 <__NSArrayM 0xa471140>(

GADMRAIDInterceptor,

NSAboutURLProtocol,

NSCFURLProtocol

)


below is the stack trace when it crashed.

Thread 6, Queue : URLConnection
#0 0x9056ea6a in __pthread_kill ()
#1 0x92a09acf in pthread_kill ()
#2 0x030e757b in abort ()
#3 0x03267f7b in abort_message ()
#4 0x03265a25 in default_terminate() ()
#5 0x02ef40c1 in _objc_terminate() ()
#6 0x032f4652 in std::terminate() ()
#7 0x02ef4039 in objc_terminate ()
#8 0x03078027 in _dispatch_client_callout ()
#9 0x03068418 in _dispatch_queue_drain ()
#10 0x030682a6 in _dispatch_queue_invoke ()
#11 0x03069280 in _dispatch_root_queue_drain ()
#12 0x03069450 in _dispatch_worker_thread2 ()
#13 0x92a0ae12 in _pthread_wqthread ()

Shin-Ping

unread,
Oct 15, 2012, 10:23:21 PM10/15/12
to google-adm...@googlegroups.com
I was using AdMob SDK version 6.2.0. 

Rajkumar Parameswaran

unread,
Oct 16, 2012, 10:36:53 AM10/16/12
to google-adm...@googlegroups.com
It sounds like this might be an issue where AdMob is registering a protocol and adding to that collection while a request is already going out. Is there any way for you to hold off on your AdMob request until your other requests are finished?

On Mon, Oct 15, 2012 at 7:23 PM, Shin-Ping <light...@gmail.com> wrote:
I was using AdMob SDK version 6.2.0. 

--
 
 
 

Shin-Ping

unread,
Oct 17, 2012, 4:37:00 AM10/17/12
to google-adm...@googlegroups.com
Does version 6.2.1 fixes this crash?  NSGenericException', reason: '*** Collection <__NSArrayM: 0xa471140> was mutated while being enumerated.'

It is very hard to reproduce this crash on version 6.2.0, so I cannot verify if 6.2.1 doesn't have the same problem.

Rajkumar Parameswaran

unread,
Oct 17, 2012, 12:01:56 PM10/17/12
to google-adm...@googlegroups.com
No, did you check if it's an issue of Admob registering a new protocol while a request is being sent out? I think as long as you make sure your AdMob request goes out at a different time from the other request it should be ok?

--
 
 
 

Rajkumar Parameswaran

unread,
Oct 24, 2012, 10:02:24 AM10/24/12
to google-adm...@googlegroups.com
Thanks for the workaround Jesse. We'll have a fix going into our next release that should dramatically reduce the chance of this crash occurring. Until then, it looks like your workaround does the trick. Thanks for posting it for others here as well.

On Tue, Oct 23, 2012 at 11:54 AM, Jesse Rusak <jesse...@mindsea.com> wrote:
Hi All,

I've filed a bug with Apple about the underlying crash; it's Radar #12556160.

I've also got a workaround in the meantime. Just stick the code below into a .m file and include it in your project; it will automatically run at startup and prevent NSURLProtocol classes from being unregistered or registered repeatedly. This dramatically reduces the chance of a crash. In my brief testing, it doesn't seem to cause any bad side-effects, but YMMV. I'd love to hear if anyone else finds any problems with this.

Cheers,
Jesse

/*
 * Begin NSURLProtocol Mutation Fix
 * This ensures that a class is only registered once with
 * NSURLProtocol and prevents classes from being unregistered.
 * This works around a crash where changing the list of protocol
 * handlers during an NSURLConnection causes a crash.
 */
#import <Foundation/Foundation.h>
#import <objc/runtime.h>

static NSMutableSet *registeredNSURLProtocols;

@implementation NSURLProtocol (SMProtocolCrashWorkaround)

+ (void)sm_unregisterClass:(Class)c {
    // intentionally blank; we disallow unregistration
}

+ (void)sm_registerClass:(Class)c {
    @synchronized(self) {
        if (!registeredNSURLProtocols) {
            registeredNSURLProtocols = [[NSMutableSet alloc] init];
        }
        if (![registeredNSURLProtocols containsObject:c]) {
            [registeredNSURLProtocols addObject:c];
            [self sm_registerClass:c];
        }
    }
}

@end

__attribute__((constructor))
static void preventProtocolMutationCrash() {
    Method unregisterMethod = class_getClassMethod([NSURLProtocol class], @selector(unregisterClass:));
    Method newUnregisterMethod = class_getClassMethod([NSURLProtocol class], @selector(sm_unregisterClass:));
    method_exchangeImplementations(unregisterMethod, newUnregisterMethod);
    
    Method registerMethod = class_getClassMethod([NSURLProtocol class], @selector(registerClass:));
    Method newRegisterMethod = class_getClassMethod([NSURLProtocol class], @selector(sm_registerClass:));
    method_exchangeImplementations(registerMethod, newRegisterMethod);
}

/*** End NSURLProtocol Mutation Fix ***/


On Friday, October 19, 2012 4:04:09 PM UTC-3, Jesse Rusak wrote:
Hi Raj,

(I sent this earlier, but it didn't seem to go through. Apologies if you get this twice.)

I believe you're correct; the issue is cased by the ads SDK registering a protocol handler while an NSURLRequest is being sent. I've put up a sample here https://www.dropbox.com/s/72gu971lsnzhej5/AdCrash.zip which simply makes a lot of ad requests concurrently with other NSURLRequests. It reproduces the crash reliably for me after a few seconds of waiting (with the 6.2.1 SDK). This crash is currently causing the majority of the all crashes we're seeing in the wild, so it would be great if this could be resolved quickly.

Unfortunately, your solution of ensuring that the ad request goes out at a different time from other requests isn't feasible; even if we could track down every NSURLRequest in all our code (and all Apple's code, and all third-party code), we wouldn't want to prevent all network traffic for the entire time we're loading an ad, since that could take tens of seconds depending on the connection.

One possible solution would be to move the call to +[NSURLProtocol registerClass] from +[GADMRAIDInterceptor allow] to, say, +[GADMRAIDInterceptor initialize] and then just use a boolean to note whether the interceptor is allowed or not. (And eliminate the call to +[NSURLProtocol unregisterClass:].) This wouldn't completely eliminate the crash but it would reduce its likelihood to almost nothing. Hopefully Apple will resolve the underlying issue, but in the meantime, it would be great if you could produce a fix such as this one.

Thanks,
Jesse

--
 
 
 

Message has been deleted

Shin-Ping

unread,
Oct 25, 2012, 4:24:40 PM10/25/12
to google-adm...@googlegroups.com
The solution that Jesse Rusak proposed works.  He doesn't let GADMRAIDInterceptor unregisters NSURLProtocol.  

I can use method swizzling and don't let GADMRAIDInterceptor register NSURLProtocal, too.  Shall I disallow GADMRAIDInterceptor from registering NSURLProtocal, too?  What will happen if I don't let GADMRAIDInterceptor register NSURLProtocal?  Will I gain the same amount of revenue?

below is Jesse Rusak's code with some modification

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

static Class GADMRAIDInterceptorClass = nil;

@implementation NSURLProtocol (SMProtocolCrashWorkaround)

+ (void)sm_unregisterClass:(Class)c {
    if (c != GADMRAIDInterceptorClass) {
        [NSURLProtocol unregisterClass:c];
    }
    // intentionally blank; we disallow unregistering GADMRAIDInterceptor
}

+ (void)sm_registerClass:(Class)c {
    if (c != GADMRAIDInterceptorClass) {
        [NSURLProtocol registerClass:c];
        return;
    }
    // intentionally blank; we disallow registering GADMRAIDInterceptor
}

@end

__attribute__((constructor))
static void preventProtocolMutationCrash() {
    GADMRAIDInterceptorClass = NSClassFromString(@"GADMRAIDInterceptor");
    
    Method unregisterMethod = class_getClassMethod([NSURLProtocol class], @selector(unregisterClass:));
    Method newUnregisterMethod = class_getClassMethod([NSURLProtocol class], @selector(sm_unregisterClass:));
    method_exchangeImplementations(unregisterMethod, newUnregisterMethod);
    
    Method registerMethod = class_getClassMethod([NSURLProtocol class], @selector(registerClass:));
    Method newRegisterMethod = class_getClassMethod([NSURLProtocol class], @selector(sm_registerClass:));
    method_exchangeImplementations(registerMethod, newRegisterMethod);
}

Rajkumar Parameswaran

unread,
Oct 31, 2012, 3:00:18 PM10/31/12
to google-adm...@googlegroups.com
I would recommend just using Jesse's workaround in this case. If you don't allow GADMRAIDInterceptor to register it could skew some reporting for MRAID ads. 

--
 
 
 

Rajkumar Parameswaran

unread,
Dec 4, 2012, 8:14:05 PM12/4/12
to google-adm...@googlegroups.com
The next release will fix this issue and is slated for Q1 of 2013. In the meantime, is there a reason the method swizzling workaround won't cut it?

On Fri, Nov 30, 2012 at 3:15 PM, Todd Huss <th...@gabrito.com> wrote:
We're anxiously awaiting a fix too, we use a crash reporting service and this is the number 1 crash by a wide margin in our production app. It pains me when we get 1 star reviews from users saying our app is crashy when by far the majority of crashes come from the AdMob SDK.


On Sunday, November 18, 2012 7:20:49 PM UTC-8, Sean Woodhouse wrote:
We're using 6.2.1 and have seen a significant number of crashes. We're about to release an update and I'm hesitant to even include the AdMob ad support with the number of crashes we're seeing. Jesse seems to have pinpointed the problem but the unregisterClass swizzle is not something we can go to production with.

Any word on when a proper fix will be available? 

Regards

Sean. 

--
 
 
 

Eric Leichtenschlag

unread,
Feb 13, 2013, 6:37:05 PM2/13/13
to google-adm...@googlegroups.com
We're hoping to have a release with this fix either later this week or early next week.

Cheers,
Eric


On Sun, Feb 10, 2013 at 5:30 PM, Nick Forge <nick....@gmail.com> wrote:
Any word on a release that will fix this issue? This is by far the number one cause of crashes in our apps, and method swizzling in a production app isn't something we're prepared to consider all that seriously.

On Wednesday, December 5, 2012 12:14:05 PM UTC+11, Raj Parameswaran wrote:
The next release will fix this issue and is slated for Q1 of 2013. In the meantime, is there a reason the method swizzling workaround won't cut it?

--
 
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
  

Eric Leichtenschlag

unread,
Feb 14, 2013, 6:24:00 PM2/14/13
to google-adm...@googlegroups.com
We just released v6.3.0 of the SDK which inlcudes a fix for this issue on iOS. You can grab the new SDK from our downloads page.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages