I am using UIWebViews in some of the screens, because I need a perfect Html text parsing.
According to crash reports a huge number of crashes, called WTF Crash, occur on these screens. Here is a trace of that crash
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000bbadbeef
Thread : Crashed: WebThread
0 JavaScriptCore 0x184fd2710 WTFCrash + 72
1 JavaScriptCore 0x184fd2708 WTFCrash + 64
2 WebCore 0x1852b7d78 <redacted> + 362
3 WebCore 0x1852b7bec <redacted> + 44
4 CoreFoundation 0x1817d8588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x1817d632c __CFRunLoopDoObservers + 372
6 CoreFoundation 0x1817d6674 __CFRunLoopRun + 696
7 CoreFoundation 0x181705680 CFRunLoopRunSpecific + 384
8 WebCore 0x1852b5998 <redacted> + 456
9 libsystem_pthread.dylib 0x18148bb28 <redacted> + 156
10 libsystem_pthread.dylib 0x18148ba8c _pthread_start + 154
11 libsystem_pthread.dylib 0x181489028 thread_start + 4
There is no OS version, or device relation on this crash.
I am not doing anything fancy on using UIWebView as well. It is added to nib like every other component, and in the implementation file I use it like the following
self.webView.scrollView.scrollEnabled = NO;
self.webView.scrollView.bounces = NO;
self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor clearColor];
self.webView.delegate = self;
[self.webView loadHTMLString:htmlString baseURL:nil];
Any suggestions on how to solve WTF Crash?
Edit: Here is how htmlString looks like
Printing description of htmlString:
<html><body style="font-family:HelveticaNeue; font-size:10; background-color:#E5E4E4; text-align:left; color:#696969 ">test string</body></html>
I don't know how you are creating your UIWebView. But I was having a similiar issue with a WTFCrash and I was able to solve it by making sure that the UIWebView was being created on the main thread:
- (void)createWebView{
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createWebView];
});
return;
}
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
//Rest of my code
}
Are you debugging your web view with Safari? If yes, the crash should be gone after you quit Safari.
I was facing a similar crash with WKWebView, and I was sure the same code worked happily 3 days ago. hlung's comments saved me, you can find it HERE.
For your reference, following is a piece of the crash log in my case.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000dbbdfb10
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 JavaScriptCore 0x225d74c6 WTF::HashSet<JSC::MarkedArgumentBuffer*, WTF::PtrHash<JSC::MarkedArgumentBuffer*>, WTF::HashTraits<JSC::MarkedArgumentBuffer*> >::remove(JSC::MarkedArgumentBuffer* const&) + 54
1 JavaScriptCore 0x22620b41 JSC::VM::~VM() + 211
2 JavaScriptCore 0x22197e57 JSC::JSLockHolder::~JSLockHolder() + 73
3 JavaScriptCore 0x2248defd JSContextGroupRelease + 61
4 JavaScriptCore 0x2250e37d -[JSVirtualMachine dealloc] + 27
5 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
6 JavaScriptCore 0x2248d261 -[JSContext dealloc] + 125
7 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
8 JavaScriptCore 0x226470af WTF::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*) + 25
9 CoreFoundation 0x1e807357 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
10 CoreFoundation 0x1e807029 __CFRunLoopDoTimer + 897
11 CoreFoundation 0x1e8069e1 __CFRunLoopDoTimers + 221
12 CoreFoundation 0x1e804cc5 __CFRunLoopRun + 1365
13 CoreFoundation 0x1e754073 CFRunLoopRunSpecific + 487
14 CoreFoundation 0x1e753e81 CFRunLoopRunInMode + 105
15 GraphicsServices 0x1ff00bfd GSEventRunModal + 157
16 UIKit 0x2390e82f -[UIApplication _run] + 575
17 UIKit 0x23908f61 UIApplicationMain + 151
18 MyApp 0x00488b29 0x2c000 + 4573993
19 libdyld.dylib 0x1df1e50b start + 3
WebKit, the engine behind Web Views, can raise a crash when it sees a memory problem.
These are identified by the special Hex Word 0x00000000bbadbeef as you have found.
The web page you are visiting seems trivial, so it is a surprise that you are having problems. I recommend you follow the WebKit debugging facilities described at:
https://webkit.org/debugging-webkit/#ios-simulator
Please update your question with any logs or insights this reveals.
It was a Google Ads issue, already fixed for sure on version 7.35.0 of October, 17 and newer versions.
You should be able to fix the issue updating your pod.
From the Google Mobile Ads SDK Developers Team mailing:
"The issue has been fixed by the team and it should go live in an upcoming SDK release (release notes)." (August, 20)
"Issue has been fixed and live already." (October, 17)
Source: https://groups.google.com/d/msg/google-admob-ads-sdk/XL35wo6mQts/R2LlGZDxBwAJ
Release Notes: https://developers.google.com/admob/ios/rel-notes
Related
We encountered an OpenGL related crash on ios14. It has nothing to do with the application background. The vast majority of crashes occurred on IOS 14 low-end devices, and it is not clear how to solve them.
The only possible clue is that the crash may have something to do with opening the WebView.
Monitor Type: Unix Signal
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x00000001c7517414
Crashed Thread: 0
Pthread id: 10322737
Thread 0 Crashed:
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 272
2 libsystem_c.dylib abort + 104
3 AppleMetalGLRenderer GLDContextRec::flushContextInternal() + 852
4 GLEngine gliPresentViewES_Exec + 188
5 OpenGLES -[EAGLContext presentRenderbuffer:] + 76
6 myapp -[EJCanvasContextWebGLScreen present] (EJCanvasContextWebGLScreen.m:142)
7 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 664
8 QuartzCore display_timer_callback(__CFMachPort*, void*, long, void*) + 280
9 CoreFoundation __CFMachPortPerform + 176
10 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
11 CoreFoundation __CFRunLoopDoSource1 + 596
12 CoreFoundation __CFRunLoopRun + 2360
13 CoreFoundation CFRunLoopRunSpecific + 600
14 GraphicsServices GSEventRunModal + 164
15 UIKitCore -[UIApplication _run] + 1072
16 UIKitCore UIApplicationMain + 168
17 myapp main (main.m:36)
18 libdyld.dylib start + 4
I'm 100% sure presentRenderBuffer works fine in iOS14.
According to the error message, it seems like a thread issue.
In my case, I use a queue to detail with all of the OpenGL things.
dispatch_sync(queue, ^{
// All of the OpenGL things
[self bindCurrentRenderBuffer];
[self presentRenderBuffer];
});
You can see my OpenGL project in Github: IRPlayer
We see a sporadic crash in our user base, during a routine read from NSUserDefaults. The overwhelming majority of users don't experience this problem, and those that do aren't running any particular version of iOS. It seems to have appeared only since we started deploying with Xcode 9.1.
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016efe3fc0
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x101816d4c #objc _NSContiguousString.length() + 5720
1 CoreFoundation 0x181e2a168 CFStringCompareWithOptionsAndLocale + 96
2 Foundation 0x1828602fc -[NSString isEqualToString:] + 76
3 CoreFoundation 0x181e19558 CFEqual + 596
4 CoreFoundation 0x181e15414 CFBasicHashFindBucket + 344
5 CoreFoundation 0x181e152a0 CFDictionaryGetValue + 224
6 CoreFoundation 0x181ef0c74 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 108
7 CoreFoundation 0x181f8f224 -[CFPrefsSource copyValueForKey:] + 64
8 CoreFoundation 0x181f992c0 __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 40
9 CoreFoundation 0x181ef44f0 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:buttConfigurationURL:perform:]_block_invoke + 268
10 CoreFoundation 0x181ef3d0c normalizeQuintuplet + 356
11 CoreFoundation 0x181ef43d8 -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:buttConfigurationURL:perform:] + 108
12 CoreFoundation 0x181f99258 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 124
13 CoreFoundation 0x181f9bbbc _CFPreferencesGetAppBooleanValueWithContainer + 136
14 Foundation 0x1828517a8 -[NSUserDefaults(NSUserDefaults) boolForKey:] + 112
15 <our code> 0x100d80750 #objc SettingsPersistence.persistedBool.getter (SettingsPersistence.swift:90)
Here's how we retrieve the value (Swift 3, called via Objective C):
fileprivate static let PersistedBoolKey = "persistedBool"
public var persistedBool: Bool {
get {
return UserDefaults.standard.bool(forKey: SettingsPersistence.PersistedBoolKey)
}
set(newPersistedBool) {
UserDefaults.standard.set(newPersistedBool, forKey: SettingsPersistence.PersistedBoolKey)
}
}
I thought it might be a thread issue, but this occurs on the main thread. Either way, NSUserDefaults is documented as completely thread-safe.
This looks to me like a low-level bug in Apple's libraries. What can I do to fix this problem on my end? Who should I report it to? Has anyone else experienced a similar problem?
Thank you!
This crash has disappeared ever since upgrading Xcode to 9.4.1.
I tried to search about createPeripheral and i had no luck finding any information about it. Is there anyone here who had the same crash as this?
[UIThreadSafeNode createPeripheral]: unrecognized selector sent to instance
Which class does createPeripheral belong to?
How do you handle this crash?
note: there's not much information in the crash log
stackTrace =
(
0 CoreFoundation 0x31dcd2bb <redacted> + 186
1 libobjc.A.dylib 0x39a7297f objc_exception_throw + 30
2 CoreFoundation 0x31dd0e07 <redacted> + 170
3 CoreFoundation 0x31dcf531 <redacted> + 392
4 CoreFoundation 0x31d26f68 _CF_forwarding_prep_0 + 24
5 UIKit 0x33d4bf99 <redacted> + 52
6 UIKit 0x33bda80f <redacted> + 38
7 UIKit 0x33bda431 <redacted> + 404
8 UIKit 0x33f1ad19 <redacted> + 236
9 libdispatch.dylib 0x39e98621 <redacted> + 80
9 libdispatch.dylib 0x39e98621 <redacted> + 80
10 libdispatch.dylib 0x39e894b7 <redacted> + 22
11 libdispatch.dylib 0x39e8adcb <redacted> + 226
12 CoreFoundation 0x31da0f3b <redacted> + 1290
13 CoreFoundation 0x31d13ebd CFRunLoopRunSpecific + 356
14 CoreFoundation 0x31d13d49 CFRunLoopRunInMode + 104
15 GraphicsServices 0x358d72eb GSEventRunModal + 74
16 UIKit 0x33c29301 UIApplicationMain + 1120
...
);
Apologies for adding to an old post, but I do have a strong reproduction case for this bug. Open any software keyboard on the iPhone6+ (or iPhone6+ simulator) in a WebView. Put something in the paste-buffer, then click the paste button.
I haven't solved it yet, but I thought this might help if anyone is lost in google for this bug.
I've just got a similar crash report.
There is UIWebBrowserView in the call stack. Maybe it is a bug in it.
Our application uses UIWebView to show a simple html page, and I receive random crashes in WebView regulary. I have no idea what to do with it.
In my case this error occured when I tried to customize -inputaccessoryview on contenteditable div.
I believe createPeripheral has something to deal with Keyboard display as
webView.keyboardDisplayRequiresUserAction = NO;
solved this crash for me.
I'm experiencing multiple crashes where it appears that a native iOS method is calling functions from a third-party library. Here's an example:
Thread: Unknown Name (Crashed)
0 libsystem_kernel.dylib 0x33222350 __pthread_kill + 8 + 8
1 libsystem_c.dylib 0x3500f973 abort + 95 + 94
2 libsystem_c.dylib 0x34ff04d1 basename + 1
3 FireChat 0x00036489 -[OTOverlayButton drawRect:] + 1
4 Foundation 0x37a4a5a9 -[NSDictionary(NSKeyValueCoding) valueForKey:] + 33 + 32
5 FireChat 0x709d -[NetworkModel getUserForUid:] (NetworkModel.m:150)
6 FireChat 0x0001c42f -[OpenTokController session:didReceiveStream:] (OpenTokController.m:258)
7 libdispatch.dylib 0x32da011f _dispatch_call_block_and_release + 11 + 10
8 libdispatch.dylib 0x32d9f4b7 _dispatch_client_callout + 23 + 22
9 libdispatch.dylib 0x32da41bd _dispatch_main_queue_callback_4CF$VARIANT$mp + 225 + 224
10 CoreFoundation 0x37dbbf3b __CFRunLoopRun + 1291 + 1290
11 CoreFoundation 0x37d2eebd CFRunLoopRunSpecific + 357 + 356
12 CoreFoundation 0x37d2ed49 CFRunLoopRunInMode + 105 + 104
13 GraphicsServices 0x358e22eb GSEventRunModal + 75 + 74
14 UIKit 0x3a1b42f9 UIApplicationMain + 1121 + 1120
15 FireChat 0x43b3 main (main.m:8)
To me, it appears that the [NSDictionary valueForKey:] method is invoking [OTOverlayButton drawRect:] which comes from a third-party library. This shouldn't be possible -- am I reading the crash report wrong?
[OTOverlayButton drawRect:] isn't called anywhere in my code. Note that the dictionary contains (my) objects which contain pointers to objects from the third-party library.
The library vendor and I are both baffled.
Thanks.
I believe the cause of this crash was memory corruption resulting from calling performSelector: on a method that returned a struct. See this blog post for more details:
Why performSelector is more dangerous than I thought
I'm trying to include a UIWebView based browser in my iPad application. It takes some time, which makes it hard to debug, but the app finally crashes, always on the same spot: the WebThread, on the JavaScriptCore WTF::StringImpl::hash() function. It produces EXC_BAD_ACCESS (SIGSEGV), KERN_INVALID_ADDRESS at 0x00000001.
The UIWebView is inside a view controller managed by another view controller (container) in a stack-like fashion. I'm only keeping four or less of those browsers in memory.
Anything about the crash log, or about what might be causing the crash?
This is the crash log of the web thread:
Thread 2 name: WebThread
Thread 2 Crashed:
0 JavaScriptCore 0x32a97d46 WTF::StringImpl::hash() const + 42
1 JavaScriptCore 0x32a97c6a WTF::HashTable<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >::lookupForWriting(WTF::StringImpl* const&) + 18
2 JavaScriptCore 0x32a9b028 std::pair<WTF::HashTableIterator<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >, bool> WTF::HashTable<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityExtractor<WTF::StringImpl*>, WTF::StringHash, WTF::HashTraits<WTF::StringImpl*>, WTF::HashTraits<WTF::StringImpl*> >::add<WTF::StringImpl*, WTF::StringImpl*, WTF::IdentityHashTranslator<WTF::StringImpl*, WTF::StringImpl*, WTF::StringHash> >(WTF::StringImpl* const&, WTF::StringImpl* const&) + 448
3 JavaScriptCore 0x32a9ae30 WTF::AtomicString::addSlowCase(WTF::StringImpl*) + 96
4 WebCore 0x31bade0c WebCore::AtomicHTMLToken::initializeAttributes(WTF::Vector<WebCore::HTMLToken::Attribute, 10ul> const&) + 232
5 WebCore 0x31b88076 WebCore::AtomicHTMLToken::AtomicHTMLToken(WebCore::HTMLToken&) + 302
6 WebCore 0x31b87eae WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&) + 14
7 WebCore 0x31b7d07e WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) + 150
8 WebCore 0x31bee29a WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution() + 50
9 WebCore 0x31bc87e6 WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) + 78
10 WebCore 0x31bc7448 WebCore::CachedResource::checkNotify() + 40
11 WebCore 0x31bc7308 WebCore::CachedScript::data(WTF::PassRefPtr<WebCore::SharedBuffer>, bool) + 84
12 WebCore 0x31bc7240 WebCore::CachedResourceRequest::didFinishLoading(WebCore::SubresourceLoader*, double) + 120
13 WebCore 0x31bc715e WebCore::SubresourceLoader::didFinishLoading(double) + 158
14 WebCore 0x31bc58c2 _ZN7WebCoreL16didFinishLoadingEP16_CFURLConnectionPKv + 46
15 CFNetwork 0x347737ee URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 186
16 CFNetwork 0x3476849e URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 418
17 CFNetwork 0x3476819c URLConnectionClient::processEvents() + 100
18 CFNetwork 0x347680d2 MultiplexerSource::perform() + 150
19 CoreFoundation 0x313d2acc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
20 CoreFoundation 0x313d2298 __CFRunLoopDoSources0 + 208
21 CoreFoundation 0x313d103e __CFRunLoopRun + 646
22 CoreFoundation 0x3135449e CFRunLoopRunSpecific + 294
23 CoreFoundation 0x31354366 CFRunLoopRunInMode + 98
24 WebCore 0x31b74c9c _ZL12RunWebThreadPv + 396
25 libsystem_c.dylib 0x33bca72e _pthread_start + 314
26 libsystem_c.dylib 0x33bca5e8 thread_start + 0
I had the same problem, spent the whole day... There were a LOT of different WebKit errors like these. Finally, I got it: this was a multi-threaded issue! I created the WebView from thread 1, then tried to modify its contents by means of JS functions in thread 2...
The simple performSelectorOnMainThread:withObject:waitUntilDone: fixed the problem!
Maybe this will help someone.
As the crash log suggests, it looks like it might be a JavaScript related problem. I assume the page you're loading has JavaScript on it? Out of interest, does the webpage run fine in Mobile Safari - is it just in a UIWebView that you have problems?
If you're unable to modify the JS, or web page seems to run fine on other mobile/desktop browsers or devices , I would suggest filing a bug with Apple along with the JavaScript used to reproduce the problem.