facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.37k stars 24.25k forks source link

Error: libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) #9921

Closed AlessandroAnnini closed 7 years ago

AlessandroAnnini commented 8 years ago

Issue Description

I Use Websocket, it was working with Xcode < 8 Now with Xcode 8, while trying to test my app on simulator i have this error stack in xcode:

bundleid: org.reactjs.native.example.MyAppName, enable_level: 0, persist_level: 0, propagate_with_activity: 0
subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
subsystem: com.apple.libsqlite3, category: logging, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
subsystem: com.apple.network, category: , enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
[] tcp_connection_create_with_endpoint_and_parameters 1 localhost 8081
[] tcp_connection_start 1 starting
[] nw_connection_create creating connection to localhost:8081
[] tcp_connection_start starting tc_nwconn=0x7fdb5be00bb0
[] __nw_connection_start_block_invoke 1 starting
[] nw_endpoint_handler_start [1 localhost:8081 initial path (null)]
[] nw_connection_endpoint_report [1 localhost:8081 initial path (null)] reported event path:start
[] nw_endpoint_handler_path_change [1 localhost:8081 waiting path (unsatisfied)]
[] nw_connection_endpoint_report [1 localhost:8081 waiting path (unsatisfied)] reported event path:unsatisfied
[] nw_endpoint_handler_path_change [1 localhost:8081 waiting path (unsatisfied)] trying resolution with unsatisfied path
[] -[NWConcrete_nw_endpoint_resolver startWithHandler:] [1 localhost:8081 waiting resolver (unsatisfied)]
[] nw_connection_endpoint_report [1 localhost:8081 in_progress resolver (unsatisfied)] reported event resolver:start_dns
[] nw_resolver_create_dns_service_on_queue Scoping resolution to LocalOnly [-1]
[] nw_resolver_create_dns_service_on_queue Starting host resolution localhost:8081, flags 0x4000d000
[] nw_resolver_host_resolve_callback flags=0x3 ifindex=4294967295 error=NoError(0) hostname=localhost. addr=::1.0 ttl=1
[] nw_resolver_host_resolve_callback flags=0x2 ifindex=4294967295 error=NoError(0) hostname=localhost. addr=127.0.0.1:0 ttl=1
[] nw_host_stats_add_src recv too small, received 24, expected 28
[] nw_host_stats_add_src recv too small, received 24, expected 28
[] sa_dst_compare_rfc6724 Rule 6, prefer d2, d2 precedence 50 > d1 precedence 35
[] sa_dst_compare_internal 127.0.0.1:8081@0 < ::1.8081@0
[] nw_endpoint_resolver_update [1 localhost:8081 in_progress resolver (unsatisfied)] resolver is complete
[] nw_endpoint_resolver_update [1 localhost:8081 in_progress resolver (unsatisfied)] Adding endpoint handler for ::1.8081
[] nw_endpoint_resolver_update [1 localhost:8081 in_progress resolver (unsatisfied)] Adding endpoint handler for 127.0.0.1:8081
[] nw_endpoint_resolver_update [1 localhost:8081 in_progress resolver (unsatisfied)] Updated endpoint list is (::1.8081,127.0.0.1:8081)
[] nw_connection_endpoint_report [1 localhost:8081 in_progress resolver (unsatisfied)] reported event resolver:receive_dns
[] nw_endpoint_resolver_start_next_child [1 localhost:8081 in_progress resolver (unsatisfied)] starting child endpoint ::1.8081
[] nw_host_stats_add_src recv too small, received 24, expected 28
[] nw_endpoint_resolver_start_next_child [1 localhost:8081 in_progress resolver (unsatisfied)] starting next child endpoint in 250ms
[] nw_endpoint_handler_start [1.1 ::1.8081 initial path (null)]
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.1 ::1.8081 initial path (null)]
[] nw_connection_endpoint_report [1.1 ::1.8081 initial path (null)] reported event path:start
[] nw_endpoint_handler_path_change [1.1 ::1.8081 waiting path (satisfied)]
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.1 ::1.8081 waiting path (satisfied)]
[] nw_connection_endpoint_report [1.1 ::1.8081 waiting path (satisfied)] reported event path:satisfied
[] nw_endpoint_proxy_handler_should_use_proxy Looking up proxy for hostname: <nil>, ifindex: 0
subsystem: com.apple.SystemConfiguration, category: SCPreferences, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
[] -[NWConcrete_nw_endpoint_flow startWithHandler:] [1.1 ::1.8081 waiting socket-flow (satisfied)]
[] nw_endpoint_flow_setup_socket [1.1 ::1.8081 in_progress socket-flow (satisfied)] creating socket
[] nw_endpoint_flow_attach_protocols [1.1 ::1.8081 in_progress socket-flow (satisfied)]
[] nw_endpoint_flow_attach_protocols [1.1 ::1.8081 in_progress socket-flow (satisfied)] Attached flow protocol
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.1 ::1.8081 in_progress socket-flow (satisfied)]
[] nw_connection_endpoint_report [1.1 ::1.8081 in_progress socket-flow (satisfied)] reported event flow:start_connect
[] nw_socket_handle_socket_event Event mask: 0x1007
[] nw_socket_handle_socket_event Socket received CONNRESET event
[] nw_socket_handle_socket_event Socket received DISCONNECTED event
[] nw_endpoint_flow_protocol_error [1.1 ::1.8081 in_progress socket-flow (satisfied)] Socket protocol sent error: [61] Connection refused
[] nw_endpoint_flow_protocol_disconnected [1.1 ::1.8081 in_progress socket-flow (satisfied)] Output protocol disconnected
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.1 ::1.8081 failed socket-flow (satisfied)]
[] nw_connection_endpoint_report [1.1 ::1.8081 failed socket-flow (satisfied)] reported event flow:failed_connect, error Error Domain=kNWErrorDomainPOSIX Code=61 "Connection refused" UserInfo={NSDescription=Connection refused}
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] all started children failed, start next child.
[] nw_endpoint_resolver_start_next_child [1 localhost:8081 in_progress resolver (unsatisfied)] starting child endpoint 127.0.0.1:8081
[] nw_host_stats_add_src recv too small, received 24, expected 28
[] nw_endpoint_resolver_start_next_child [1 localhost:8081 in_progress resolver (unsatisfied)] starting next child endpoint in 250ms
[] nw_endpoint_handler_start [1.2 127.0.0.1:8081 initial path (null)]
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.2 127.0.0.1:8081 initial path (null)]
[] nw_connection_endpoint_report [1.2 127.0.0.1:8081 initial path (null)] reported event path:start
[] nw_endpoint_handler_path_change [1.2 127.0.0.1:8081 waiting path (satisfied)]
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.2 127.0.0.1:8081 waiting path (satisfied)]
[] nw_connection_endpoint_report [1.2 127.0.0.1:8081 waiting path (satisfied)] reported event path:satisfied
[] nw_endpoint_proxy_handler_should_use_proxy Looking up proxy for hostname: <nil>, ifindex: 0
[] -[NWConcrete_nw_endpoint_flow startWithHandler:] [1.2 127.0.0.1:8081 waiting socket-flow (satisfied)]
[] nw_endpoint_flow_setup_socket [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)] creating socket
[] nw_endpoint_flow_attach_protocols [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)]
[] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed
[] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
[] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
        [x86_64] libnetcore-856.1.8
    0   libsystem_network.dylib             0x0000000112e7c80e __nw_create_backtrace_string + 123
    1   libnetwork.dylib                    0x00000001136eb194 nw_socket_add_input_handler + 3002
    2   libnetwork.dylib                    0x00000001136c8db8 nw_endpoint_flow_attach_protocols + 3768
    3   libnetwork.dylib                    0x00000001136c7dd5 nw_endpoint_flow_setup_socket + 563
    4   libnetwork.dylib                    0x00000001136c6b34 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
    5   libnetwork.dylib                    0x00000001136e1d11 nw_endpoint_handler_path_change + 1261
    6   libnetwork.dylib                    0x00000001136e1740 nw_endpoint_handler_start + 570
    7   libnetwork.dylib                    0x00000001136f9003 nw_endpoint_resolver_start_next_child + 2240
    8   libdispatch.dylib                   0x000000
[] nw_endpoint_flow_attach_protocols [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)] Attached flow protocol
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)]
[] nw_connection_endpoint_report [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)] reported event flow:start_connect
[] nw_socket_handle_socket_event Event mask: 0x1007
[] nw_socket_handle_socket_event Socket received CONNRESET event
[] nw_socket_handle_socket_event Socket received DISCONNECTED event
[] nw_endpoint_flow_protocol_error [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)] Socket protocol sent error: [61] Connection refused
[] nw_endpoint_flow_protocol_disconnected [1.2 127.0.0.1:8081 in_progress socket-flow (satisfied)] Output protocol disconnected
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] received child report:[1.2 127.0.0.1:8081 failed socket-flow (satisfied)]
[] nw_connection_endpoint_report [1.2 127.0.0.1:8081 failed socket-flow (satisfied)] reported event flow:failed_connect, error Error Domain=kNWErrorDomainPOSIX Code=61 "Connection refused" UserInfo={NSDescription=Connection refused}
[] nw_endpoint_resolver_receive_report [1 localhost:8081 in_progress resolver (unsatisfied)] all children failed
[] nw_connection_endpoint_report [1 localhost:8081 failed resolver (unsatisfied)] reported event resolver:children_failed
[] __tcp_connection_start_block_invoke 1 sending event TCP_CONNECTION_EVENT_DISCONNECTED in response to state failed and error Error Domain=kNWErrorDomainPOSIX Code=61 "Connection refused" UserInfo={NSDescription=Connection refused}
[] tcp_connection_event_notify 1 event: TCP_CONNECTION_EVENT_DISCONNECTED, reason: nw_connection event, should deliver: true
[] tcp_connection_cancel 1
[] nw_endpoint_handler_cancel [1 localhost:8081 failed resolver (unsatisfied)]
[] nw_endpoint_handler_cancel [1.1 ::1.8081 failed socket-flow (satisfied)]
[] nw_endpoint_handler_cancel [1.2 127.0.0.1:8081 failed socket-flow (satisfied)]
[] nw_resolver_cancel_on_queue 0x600000118ed0
[] -[NWConcrete_tcp_connection dealloc] 1
 Assertion failure in -[RCTBatchedBridge loadSource:](), /Users/sunrising/Documents/Leaff/MyAppName/node_modules/react-native/React/Base/RCTBatchedBridge.m:192
 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bundleURL must be non-nil when not implementing loadSourceForBridge'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010eb1634b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010da2621e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010eb1a442 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010d5f2e09 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    4   MyAppName                    0x000000010d14a9b4 -[RCTBatchedBridge loadSource:] + 740
    5   MyAppName                    0x000000010d148d94 -[RCTBatchedBridge start] + 468
    6   MyAppName                    0x000000010d148a93 -[RCTBatchedBridge initWithParentBridge:] + 1251
    7   MyAppName                    0x000000010d185161 -[RCTBridge createBatchedBridge] + 65
    8   MyAppName                    0x000000010d185050 -[RCTBridge setUp] + 512
    9   MyAppName                    0x000000010d1841c3 -[RCTBridge initWithDelegate:bundleURL:moduleProvider:launchOptions:] + 387
    10  MyAppName                    0x000000010d183fd2 -[RCTBridge initWithBundleURL:moduleProvider:launchOptions:] + 146
    11  MyAppName                    0x000000010d0eb047 -[RCTRootView initWithBundleURL:moduleName:initialProperties:launchOptions:] + 183
    12  MyAppName                    0x000000010d0cf0a5 -[AppDelegate application:didFinishLaunchingWithOptions:] + 245
    13  UIKit                               0x000000011129168e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
    14  UIKit                               0x0000000111293013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
    15  UIKit                               0x00000001112993b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
    16  UIKit                               0x0000000111296539 -[UIApplication workspaceDidEndTransaction:] + 188
    17  FrontBoardServices                  0x000000011472576b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    18  FrontBoardServices                  0x00000001147255e4 -[FBSSerialQueue _performNext] + 189
    19  FrontBoardServices                  0x000000011472596d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    20  CoreFoundation                      0x000000010eabb311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    21  CoreFoundation                      0x000000010eaa059c __CFRunLoopDoSources0 + 556
    22  CoreFoundation                      0x000000010ea9fa86 __CFRunLoopRun + 918
    23  CoreFoundation                      0x000000010ea9f494 CFRunLoopRunSpecific + 420
    24  UIKit                               0x0000000111294db6 -[UIApplication _run] + 434
    25  UIKit                               0x000000011129af34 UIApplicationMain + 159
    26  MyAppName                    0x000000010d0cf47f main + 111
    27  libdyld.dylib                       0x0000000112c6f68d start + 1
    28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
pppluto commented 8 years ago

same here. After I update Xcode to Xcode8 and solved Ignoring return value of function declared with warn_unused_result attribute it works fine but has infinite log in Xcode like

2016-09-21 14:22:14.129377 free[7145:7341205] [] tcp_connection_cancel 282
2016-09-21 14:22:14.131081 free[7145:7341205] [] nw_endpoint_handler_cancel [282 localhost:8097 failed resolver (satisfied)]
2016-09-21 14:22:14.132817 free[7145:7341205] [] nw_resolver_cancel_on_queue 0x7a972280
2016-09-21 14:22:14.133072 free[7145:7341205] [] -[NWConcrete_tcp_connection dealloc] 282
....
[] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
        [i386] libnetcore-856.1.8
    0   libsystem_network.dylib             0x064bd2bd __nw_create_backtrace_string + 123
    1   libnetwork.dylib                    0x06873682 nw_socket_add_input_handler + 3484
    2   libnetwork.dylib                    0x0684ed29 nw_endpoint_flow_attach_protocols + 4199
    3   libnetwork.dylib                    0x0684dba5 nw_endpoint_flow_setup_socket + 581
    4   libnetwork.dylib                    0x0684c84d -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2545
    5   libnetwork.dylib                    0x06869c35 nw_endpoint_handler_path_change + 2834
    6   libnetwork.dylib                    0x0686903c nw_endpoint_handler_start + 589
    7   libnetwork.dylib                    0x068826e0 nw_endpoint_resolver_start_next_child + 2634
    8   libdispatch.dylib                   0x0625b3ee _dispatch_call_block_and_release + 15
    9   libdispatch.dylib

anyone know what happend and how to make it clean?

AlessandroAnnini commented 8 years ago

try to completely remove watchman and reinstall it

rm -rf /usr/local/var/run/watchman/ && brew uninstall watchman && brew install watchman 

as stated here: https://github.com/facebook/react-native/issues/9943#issuecomment-247899222 for me it was the solution!

tianjianchn commented 8 years ago

@sun2rise not work for me, the annoying infinite nw_connection_xxx logs are still there

pppluto commented 8 years ago

@sun2rise @kiliwalk not work for me too. i downgrade Xcode :cry:

zh-wowtv commented 7 years ago

I think it's xcode 8 related problem because it happens in my project which has nothing to do with the React-native. But don't know how to solve it.

tianjianchn commented 7 years ago

@MrPluto @zh-wowtv see here It fixes my problem!

pppluto commented 7 years ago

@kiliwalk Yes, but i didn't use Xcode8 caz i dont know the real reason about this. and Here is another discussion about this

chetstone commented 7 years ago

This is supposedly fixed in XCode 8.1. http://stackoverflow.com/a/39887284/1404185