Description
Environment
react-native -v
: 0.44.3node -v
: 7.7.1npm -v
: 4.1.2yarn --version
:
- Target Platform: iOS & Android
- Development Operating System: macOS
- Build tools: Xcode, Android Studio, Issue particular to iOS
Steps to Reproduce
- Navigate in and out of WebView instance a couple of time on iPhone causes a crash.
- Usually of the type EXC_BAD_ACCESS KERN_INVALID_ADDRESS or SIGSEGV
- Mostly seen on newer devices 7/7Plus
Logs:
Crashed: WebThread SIGSEGV 0x0000001000000001
0 WebCore 0x193eb6824 WebCore::RenderStyle::~RenderStyle() + 84
1 WebCore 0x193edd008 WebCore::StyleResolver::invalidateMatchedPropertiesCache() + 80
2 WebCore 0x193edd008 WebCore::StyleResolver::invalidateMatchedPropertiesCache() + 80
3 WebCore 0x194c338b8 WebCore::RuleSet::addChildRules(WTF::Vector<WTF::RefPtrWebCore::StyleRuleBase, 0ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, bool, bool, WebCore::AddRuleFlags) + 456
4 WebCore 0x194c339bc WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetContents&, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*) + 192
5 WebCore 0x19425d06c WebCore::DocumentRuleSets::appendAuthorStyleSheets(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::MediaQueryEvaluator*, WebCore::InspectorCSSOMWrappers&, WebCore::StyleResolver*) + 104
6 WebCore 0x194d20974 WebCore::StyleResolver::appendAuthorStyleSheets(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul> const&) + 36
7 WebCore 0x194d2e9d4 WebCore::Style::Scope::updateStyleResolver(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul>&, WebCore::Style::Scope::StyleResolverUpdateType) + 92
8 WebCore 0x194d2e584 WebCore::Style::Scope::updateActiveStyleSheets(WebCore::Style::Scope::UpdateType) + 568
9 WebCore 0x194241278 WebCore::Document::fonts() + 88
10 WebCore 0x1945c8db4 WebCore::jsDocumentFonts(JSC::ExecState*, long long, JSC::PropertyName) + 128
11 JavaScriptCore 0x19324a540 llint_slow_path_get_by_id + 1100
12 JavaScriptCore 0x1939e2710 llint_entry + 10368
13 JavaScriptCore 0x1939e65d0 llint_entry + 26432
14 JavaScriptCore 0x1939e65d0 llint_entry + 26432
15 JavaScriptCore 0x1939dfcc8 vmEntryToJavaScript + 264
16 JavaScriptCore 0x1938c9710 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 164
17 JavaScriptCore 0x193256610 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 416
18 JavaScriptCore 0x193954100 JSC::JSPromise::initialize(JSC::ExecState*, JSC::JSGlobalObject*, JSC::JSValue) + 288
19 JavaScriptCore 0x1939545d0 JSC::constructPromise(JSC::ExecState*) + 188
20 JavaScriptCore 0x193252270 JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) + 456
21 JavaScriptCore 0x1939e6958 llint_entry + 27336
22 JavaScriptCore 0x1939e65d0 llint_entry + 26432
23 JavaScriptCore 0x1939e65d0 llint_entry + 26432
24 JavaScriptCore 0x1939e65d0 llint_entry + 26432
25 JavaScriptCore 0x1939e65d0 llint_entry + 26432
26 JavaScriptCore 0x1939e65d0 llint_entry + 26432
27 JavaScriptCore 0x1939e65d0 llint_entry + 26432
28 JavaScriptCore 0x1939e6a10 llint_entry + 27520
29 JavaScriptCore 0x1939e65d0 llint_entry + 26432
30 JavaScriptCore 0x1939dfcc8 vmEntryToJavaScript + 264
31 JavaScriptCore 0x1938c9710 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 164
32 JavaScriptCore 0x193256610 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 416
33 JavaScriptCore 0x193562850 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtrJSC::Exception&) + 176
34 WebCore 0x193fb27d0 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 1068
35 WebCore 0x1942c131c WebCore::EventTarget::fireEventListeners(WebCore::Event&, WTF::Vector<WTF::RefPtrWebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow, 16ul>) + 820
36 WebCore 0x1942c0c90 WebCore::EventTarget::fireEventListeners(WebCore::Event&) + 236
37 WebCore 0x1942b4c94 WebCore::EventContext::handleLocalEvents(WebCore::Event&) const + 116
38 WebCore 0x1942b5cd4 WebCore::EventDispatcher::dispatchEvent(WebCore::Node&, WebCore::Event&) + 800
39 WebCore 0x19443c718 non-virtual thunk to WebCore::HTMLScriptElement::dispatchLoadEvent() + 84
40 WebCore 0x194c4157c WebCore::ScriptElement::executeScriptAndDispatchEvent(WebCore::LoadableScript&) + 344
41 WebCore 0x194c46a40 WebCore::ScriptRunner::timerFired() + 504
42 WebCore 0x193ebee00 WebCore::ThreadTimers::sharedTimerFiredInternal() + 172
43 WebCore 0x193ebed40 WebCore::timerFired(__CFRunLoopTimer*, void*) + 28
44 CoreFoundation 0x18f2f1aa4 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 28
45 CoreFoundation 0x18f2f17a8 __CFRunLoopDoTimer + 856
46 CoreFoundation 0x18f2f1068 __CFRunLoopDoTimers + 244
47 CoreFoundation 0x18f2eec8c __CFRunLoopRun + 1484
48 CoreFoundation 0x18f21eda4 CFRunLoopRunSpecific + 424
49 WebCore 0x193ef0d3c RunWebThread(void*) + 456
50 libsystem_pthread.dylib 0x18e40568c _pthread_body + 240
51 libsystem_pthread.dylib 0x18e40559c _pthread_body + 282
52 libsystem_pthread.dylib 0x18e402cb4 thread_start + 4
Crashed: WebThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000006204094000
0 WebCore 0x193eb68e0 WebCore::RenderStyle::~RenderStyle() + 272
1 WebCore 0x193edd008 WebCore::StyleResolver::invalidateMatchedPropertiesCache() + 80
2 WebCore 0x193edd008 WebCore::StyleResolver::invalidateMatchedPropertiesCache() + 80
3 WebCore 0x194c338b8 WebCore::RuleSet::addChildRules(WTF::Vector<WTF::RefPtrWebCore::StyleRuleBase, 0ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, bool, bool, WebCore::AddRuleFlags) + 456
4 WebCore 0x194c339bc WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetContents&, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*) + 192
5 WebCore 0x19425d06c WebCore::DocumentRuleSets::appendAuthorStyleSheets(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::MediaQueryEvaluator*, WebCore::InspectorCSSOMWrappers&, WebCore::StyleResolver*) + 104
6 WebCore 0x194d20974 WebCore::StyleResolver::appendAuthorStyleSheets(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul> const&) + 36
7 WebCore 0x194d2e9d4 WebCore::Style::Scope::updateStyleResolver(WTF::Vector<WTF::RefPtrWebCore::CSSStyleSheet, 0ul, WTF::CrashOnOverflow, 16ul>&, WebCore::Style::Scope::StyleResolverUpdateType) + 92
8 WebCore 0x194d2e584 WebCore::Style::Scope::updateActiveStyleSheets(WebCore::Style::Scope::UpdateType) + 568
9 WebCore 0x194241278 WebCore::Document::fonts() + 88
10 WebCore 0x1945c8db4 WebCore::jsDocumentFonts(JSC::ExecState*, long long, JSC::PropertyName) + 128
11 JavaScriptCore 0x19324a540 llint_slow_path_get_by_id + 1100
12 JavaScriptCore 0x1939e2710 llint_entry + 10368
13 JavaScriptCore 0x1939e65d0 llint_entry + 26432
14 JavaScriptCore 0x1939e65d0 llint_entry + 26432
15 JavaScriptCore 0x1939dfcc8 vmEntryToJavaScript + 264
16 JavaScriptCore 0x1938c9710 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 164
17 JavaScriptCore 0x193256610 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 416
18 JavaScriptCore 0x193954100 JSC::JSPromise::initialize(JSC::ExecState*, JSC::JSGlobalObject*, JSC::JSValue) + 288
19 JavaScriptCore 0x1939545d0 JSC::constructPromise(JSC::ExecState*) + 188
20 JavaScriptCore 0x193252270 JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) + 456
21 JavaScriptCore 0x1939e6958 llint_entry + 27336
22 JavaScriptCore 0x1939e65d0 llint_entry + 26432
23 JavaScriptCore 0x1939e65d0 llint_entry + 26432
24 JavaScriptCore 0x1939e65d0 llint_entry + 26432
25 JavaScriptCore 0x1939e65d0 llint_entry + 26432
26 JavaScriptCore 0x1939e65d0 llint_entry + 26432
27 JavaScriptCore 0x1939e65d0 llint_entry + 26432
28 JavaScriptCore 0x1939e6a10 llint_entry + 27520
29 JavaScriptCore 0x1939e65d0 llint_entry + 26432
30 JavaScriptCore 0x1939dfcc8 vmEntryToJavaScript + 264
31 JavaScriptCore 0x1938c9710 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 164
32 JavaScriptCore 0x193256610 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 416
33 JavaScriptCore 0x193562850 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtrJSC::Exception&) + 176
34 WebCore 0x193fb27d0 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 1068
35 WebCore 0x1942c131c WebCore::EventTarget::fireEventListeners(WebCore::Event&, WTF::Vector<WTF::RefPtrWebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow, 16ul>) + 820
36 WebCore 0x1942c0c90 WebCore::EventTarget::fireEventListeners(WebCore::Event&) + 236
37 WebCore 0x1942b4c94 WebCore::EventContext::handleLocalEvents(WebCore::Event&) const + 116
38 WebCore 0x1942b5cd4 WebCore::EventDispatcher::dispatchEvent(WebCore::Node&, WebCore::Event&) + 800
39 WebCore 0x19443c718 non-virtual thunk to WebCore::HTMLScriptElement::dispatchLoadEvent() + 84
40 WebCore 0x194c4157c WebCore::ScriptElement::executeScriptAndDispatchEvent(WebCore::LoadableScript&) + 344
41 WebCore 0x194c46a40 WebCore::ScriptRunner::timerFired() + 504
42 WebCore 0x193ebee00 WebCore::ThreadTimers::sharedTimerFiredInternal() + 172
43 WebCore 0x193ebed40 WebCore::timerFired(__CFRunLoopTimer*, void*) + 28
44 CoreFoundation 0x18f2f1aa4 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 28
45 CoreFoundation 0x18f2f17a8 __CFRunLoopDoTimer + 856
46 CoreFoundation 0x18f2f1068 __CFRunLoopDoTimers + 244
47 CoreFoundation 0x18f2eec8c __CFRunLoopRun + 1484
48 CoreFoundation 0x18f21eda4 CFRunLoopRunSpecific + 424
49 WebCore 0x193ef0d3c RunWebThread(void*) + 456
50 libsystem_pthread.dylib 0x18e40568c _pthread_body + 240
51 libsystem_pthread.dylib 0x18e40559c _pthread_body + 282
52 libsystem_pthread.dylib 0x18e402cb4 thread_start + 4
FWIW, here's our implementation
let webviewComponent;
const webviewProps = {
ref: (ref) => {
this._webViewRef = ref;
this.props.setWebViewRef(ref);
},
automaticallyAdjustContentInsets: false,
style: styles.container,
source: {
uri: this.props.url,
headers: {
'X-CLIENT': Constants.requestXClientHeader,
},
},
onNavigationStateChange: this.navStateHandler,
javaScriptEnabled: true,
startInLoadingState: true,
scalesPageToFit: true,
};
webviewComponent = <WebView {...webviewProps} />;
showToolbarSpinner = false;