Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"__nw_connection_get_connected_socket_block_invoke Connection has no connected handler" in logs #10027

Closed
jaggerwang opened this issue Sep 21, 2016 · 133 comments
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Priority: Low

Comments

@jaggerwang
Copy link

jaggerwang commented Sep 21, 2016

Workaround

Edit by @hramos, maintainer:

Several solutions have been presented in this thread:

OS_ACTIVITY_MODE

@HADB proposed:

  1. Open Xcode.
  2. Open Product menu.
  3. Select Edit Scheme...
  4. Add the following under Environment Variables:
    Name: OS_ACTIVITY_MODE
    Value: disable
  5. Run your app again

Using react-devtools

Alternatively, ensure react-devtools is installed on your system.

Resolution

This is a known issue in the iOS Simulator. The issue will remain open to increase visibility. We are limited comments on this thread to core contributors. Pull requests with proposed fixes are welcome.

Original Issue

ENV

RN 0.32
iOS 10, iPhone 6 Plus

Problem

The console of Xcode continue print "__nw_connection_get_connected_socket_block_invoke 6 Connection has no connected handler".

Screen

image

@aprct
Copy link

aprct commented Sep 21, 2016

+1

@matthiasdilger
Copy link

matthiasdilger commented Sep 22, 2016

+1 not possible to fetch() remote json data on ios10 w/ RN 0.33

@chujian
Copy link

chujian commented Sep 22, 2016

+1 ios 10.0.1 RN 0.33

@cocbin
Copy link

cocbin commented Sep 22, 2016

+1

3 similar comments
@imoreapps
Copy link

+1

@mceoin
Copy link

mceoin commented Sep 23, 2016

+1

@HADB
Copy link

HADB commented Sep 23, 2016

+1

@marcpechaitis
Copy link

marcpechaitis commented Sep 23, 2016

Also happening with iOS 10.0.1 and RN 0.30

edit: I followed the recommendations here and am no longer getting the messages

@aprct
Copy link

aprct commented Sep 23, 2016

Still an issue with:
RN 0.34
XCode 8.0
iOS 10.0 simulator

It's working with the iOS 9.2 simulator, however.

@DrBeak1
Copy link

DrBeak1 commented Sep 23, 2016

@marcpechaitis I'm not able to get to the library file for RCTWebSocket how did you find it? RTCWebSocket doesn't show up in my targets.

@marcpechaitis
Copy link

@DrBeak1

screen shot 2016-09-23 at 1 24 20 pm

@DrBeak1
Copy link

DrBeak1 commented Sep 23, 2016

Thanks for responding @marcpechaitis . Ah. OK - I think the issue is that react-native is integrated into my project, which was originally ONLY a native obj-c project. React was integrated in afterwards (using instructions here). So my project doesn't have a Libraries folder that contains each of the individual xcodeproj files. The files are in the project, just not contained within a target:
screen shot 2016-09-23 at 1 08 19 pm

@pt-br
Copy link

pt-br commented Sep 23, 2016

+1

@DrBeak1
Copy link

DrBeak1 commented Sep 23, 2016

I was able to track down the RCTWebSocket.xcodeproj, open it, and alter the warning flags but the annoying __nw_connection_get_connected_socket_block_invoke log persists. The method mentioned by @marcpechaitis (ref from here) to fix this does not work for pre-existing apps that have integrated react-native (vs apps that started as react-native apps). I can't even find where this log call is being fired off (not in obj-c files, not in any node-modules). still investigating.

edit: this is only an issue when building against main.jsbundle ... if I build against localhost (debug) these logs go away. I suspect that because I'm building in debug mode RN assumes I want to connect to the debug localhost server; which in this case is not true. My RN development is finished, and that portion of the app is running using the main.jsbundle file I created.

@matthiasdilger
Copy link

The build error that @marcpechaitis mentioned was fixed in RN 0.33
This error is a runtime error. Interestingly, it works for me in ios 10 simulator but not on the actual device.

@DrBeak1
Copy link

DrBeak1 commented Sep 24, 2016

@matthiasdilger oops, thought @marcpechaitis was referencing the OP.
screen shot 2016-09-23 at 5 01 17 pm

@HADB
Copy link

HADB commented Sep 24, 2016

Hi, guys! This works for me (on simulator):

  1. Xcode menu -> Product -> Edit Scheme...
  2. Environment Variables -> Add -> Name: "OS_ACTIVITY_MODE", Value:"disable"
  3. Run your app again, done! 😄

@matthiasdilger
Copy link

@HADB still fails on device for me

@matthiasdilger
Copy link

matthiasdilger commented Sep 24, 2016

Got it working on device and simulator now by reassigning all signing certificates and entitlements in the project.

Xcode 8.0, ios10, iphone 5s

@imoreapps
Copy link

Below RCTWebSocket target's compiler settings works for me.
rctwebsocket xcodeproj

@fud
Copy link

fud commented Sep 24, 2016

None of these solutions work for me at all. I've added in the exceptions in my info.plist and I just can't connect to my package server from my physical phone. I don't want to turn off errors like @HADB mentioned with OS_ACTIVITY_MODE as well, this is a legitimate error.

@fatonramadani
Copy link

Any fix for this issue ?

@aleclarson
Copy link
Contributor

aleclarson commented Sep 28, 2016

+1

RN 0.34.0
iOS 10.0.1
iPhone 5S

In the iOS 10 simulator, I'm also getting a ton of __nw related log messages.

@frnk94
Copy link

frnk94 commented Sep 28, 2016

+1

RN 0.35.0-rc.0
IOS 10.1
Iphone 7 Plus

@JansenLi
Copy link

+1

@aleclarson
Copy link
Contributor

aleclarson commented Sep 28, 2016

This seems to be an iOS 10 issue, and not a React Native one.

https://twitter.com/xenadu02/status/776669668404629504

Using OS_ACTIVITY_MODE=disable (as HADB suggests) is the only current workaround.

@frnk94
Copy link

frnk94 commented Sep 28, 2016

@aleclarson I agreed with the log part but react-native still fail to fetch the bundle file on IOS 10

@aleclarson
Copy link
Contributor

@frnk94 Are you talking about the .jsbundle? The packager is serving my development bundle just fine.

You might be using an outdated AppDelegate.m if it doesn't have this:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

@frnk94
Copy link

frnk94 commented Sep 28, 2016

@alanchenup I think its an issue with my AppDelegate.m not connecting to my actual device thanks for the reply i'l fix my code ! :). It working great in simulator

@willbattel
Copy link

This still is a problem on React Native 0.50.4, Xcode 9.1, iOS 11.1, macOS High Sierra

TCP Conn 0x1c03627c0 Failed : error 0:61 [61]
[] nw_connection_get_connected_socket 164 Connection has no connected handler
over and over again, drowning out all other logs...

@pabloruiz55
Copy link

pabloruiz55 commented Dec 5, 2017

I'm having the same issue on my iPhone 6s, iOS 10. Compiled the iOS project from Xcode as per the wiki instructions and the app freezes in the splash screen. This is the log I'm getting:

2017-12-05 13:20:06.849 [info][tid:main][RCTBatchedBridge.m:75] Initializing <RCTBatchedBridge: 0x1c01ba080> (parent: <RCTBridge: 0x1c00d0450>, executor: RCTJSCExecutor)
2017-12-05 13:20:06.854783-0300 StatusIm[1755:195391] Initializing <RCTBatchedBridge: 0x1c01ba080> (parent: <RCTBridge: 0x1c00d0450>, executor: RCTJSCExecutor)
2017-12-05 13:20:09.213 [info][tid:com.facebook.react.JavaScript] There was an error collecting entropy from the browser:
2017-12-05 13:20:09.213595-0300 StatusIm[1755:195564] There was an error collecting entropy from the browser:
2017-12-05 13:20:09.216 [info][tid:com.facebook.react.JavaScript] { [TypeError: undefined is not an object (evaluating 'sjcl.random')]
  line: 61724,
  column: 28,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:09.215912-0300 StatusIm[1755:195564] { [TypeError: undefined is not an object (evaluating 'sjcl.random')]
  line: 61724,
  column: 28,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:09.305 [info][tid:com.facebook.react.JavaScript] There was an error collecting entropy from the browser:
2017-12-05 13:20:09.305135-0300 StatusIm[1755:195564] There was an error collecting entropy from the browser:
2017-12-05 13:20:09.306 [info][tid:com.facebook.react.JavaScript] { [Error: Requiring module "629", which threw an exception.]
  line: 136,
  column: 15,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:09.305704-0300 StatusIm[1755:195564] { [Error: Requiring module "629", which threw an exception.]
  line: 136,
  column: 15,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:09.526 [info][tid:main][RCTRootView.m:284] Running application StatusIm ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-12-05 13:20:09.526001-0300 StatusIm[1755:195391] Running application StatusIm ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-12-05 13:20:09.530 [info][tid:com.facebook.react.JavaScript] Running application "StatusIm" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-12-05 13:20:09.530103-0300 StatusIm[1755:195564] Running application "StatusIm" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-12-05 13:20:09.587 [info][tid:com.facebook.react.JavaScript] Loading Closure base.
2017-12-05 13:20:09.587179-0300 StatusIm[1755:195564] Loading Closure base.
2017-12-05 13:20:09.588 [info][tid:com.facebook.react.JavaScript] Shimming require
2017-12-05 13:20:09.587855-0300 StatusIm[1755:195564] Shimming require
2017-12-05 13:20:10.377936-0300 StatusIm[1755:195547] [] nw_connection_get_connected_socket 3 Connection has no connected handler
2017-12-05 13:20:10.377975-0300 StatusIm[1755:195547] TCP Conn 0x1c0164a40 Failed : error 0:61 [61]
2017-12-05 13:20:10.709350-0300 StatusIm[1755:195547] TIC TCP Conn Failed [4:0x1c4162340]: 1:61 Err(61)
2017-12-05 13:20:10.709579-0300 StatusIm[1755:195547] Task <6BA6D0FB-6F5F-459F-8D6A-AB299AF9D169>.<1> HTTP load failed (error code: -1004 [1:61])
2017-12-05 13:20:10.710073-0300 StatusIm[1755:195537] Task <6BA6D0FB-6F5F-459F-8D6A-AB299AF9D169>.<1> finished with error - code: -1004
2017-12-05 13:20:10.716 [error][tid:com.facebook.react.JavaScript] { [TypeError: Network request failed]
  line: 6335,
  column: 29,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:10.716440-0300 StatusIm[1755:195564] { [TypeError: Network request failed]
  line: 6335,
  column: 29,
  sourceURL: 'http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false' }
2017-12-05 13:20:10.828 [warn][tid:com.facebook.react.JavaScript] Possible Unhandled Promise Rejection (id: 0):
error is not a function. (In 'error()', 'error' is an instance of TypeError)
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:129458:21
tryCallOne@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:3829:14
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:3915:25
callTimer@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2142:17
callImmediatesPass@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2228:36
callImmediates@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2238:48
guard@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1860:7
__callImmediates@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2008:12
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1897:31
guard@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1860:7
callFunctionReturnFlushedQueue@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1895:12
callFunctionReturnFlushedQueue@[native code]
2017-12-05 13:20:10.828779-0300 StatusIm[1755:195564] Possible Unhandled Promise Rejection (id: 0):
error is not a function. (In 'error()', 'error' is an instance of TypeError)
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:129458:21
tryCallOne@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:3829:14
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:3915:25
callTimer@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2142:17
callImmediatesPass@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2228:36
callImmediates@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2238:48
guard@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1860:7
__callImmediates@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2008:12
http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1897:31
guard@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1860:7
callFunctionReturnFlushedQueue@http://192.168.0.13.xip.io:8081/index.ios.bundle?platform=ios&dev=true&minify=false:1895:12
callFunctionReturnFlushedQueue@[native code]
2017-12-05 13:20:13.504143-0300 StatusIm[1755:195547] [] nw_connection_get_connected_socket 6 Connection has no connected handler
2017-12-05 13:20:13.504274-0300 StatusIm[1755:195547] TCP Conn 0x1c0167f80 Failed : error 0:61 [61]

2017-12-05 13:20:16.618225-0300 StatusIm[1755:195543] [] nw_connection_get_connected_socket 7 Connection has no connected handler
2017-12-05 13:20:16.618266-0300 StatusIm[1755:195543] TCP Conn 0x1c0167800 Failed : error 0:61 [61]
2017-12-05 13:20:19.735413-0300 StatusIm[1755:195537] [] nw_connection_get_connected_socket 8 Connection has no connected handler
2017-12-05 13:20:19.735505-0300 StatusIm[1755:195537] TCP Conn 0x1c0167d40 Failed : error 0:61 [61]
2017-12-05 13:20:22.848930-0300 StatusIm[1755:195543] [] nw_connection_get_connected_socket 9 Connection has no connected handler
2017-12-05 13:20:22.848997-0300 StatusIm[1755:195543] TCP Conn 0x1c01663c0 Failed : error 0:61 [61]

And it goes on and on...

@willbattel
Copy link

Can anyone report if RN 0.51.0 fixed this? I doubt it did but I haven't been able to test it yet.

@chris-247-sloan
Copy link

chris-247-sloan commented Dec 7, 2017

Sadly it still exists.

~/Documents/Development/ReactNative/AwesomeProject$ react-native -v
react-native-cli: 2.0.1
react-native: 0.51.0

Xcode:

2017-12-07 09:19:17.996487+0000 AwesomeProject[1887:905415] TCP Conn 0x1c016c600 Failed : error 0:61 [61]
2017-12-07 09:19:20.199010+0000 AwesomeProject[1887:905411] [] nw_connection_get_connected_socket 22 Connection has no connected handler
2017-12-07 09:19:20.199120+0000 AwesomeProject[1887:905411] TCP Conn 0x1c416a140 Failed : error 0:61 [61]
2017-12-07 09:19:22.329654+0000 AwesomeProject[1887:905417] [] nw_connection_get_connected_socket 23 Connection has no connected handler
2017-12-07 09:19:22.329713+0000 AwesomeProject[1887:905417] TCP Conn 0x1c016c600 Failed : error 0:61 [61]
2017-12-07 09:19:24.472388+0000 AwesomeProject[1887:905417] [] nw_connection_get_connected_socket 24 Connection has no connected handler

@leavesster
Copy link

Disable OS_ACTIVITY_MODE is not a good way.

At first, I run yarn start at React-native root. The crazy log goes away in simulator, but still appears in real device.

After several hours working, and read all comment again and again. I finally find @emilsjolander 878b7e4 works perfectly.

I get rid of this crazy log by comment the code in - (void)reconnect function , which inReact/RCTWebSocket/RCTReconnectingWebSockect.m.
The the crazy log go away. But it just a workaround. You won't want do this every time.

For others, I think upgrade React-native to 0.51.0 may solve this problem, seems 878b7e4 is in that branch.

@pigflymoon
Copy link

It still exists.
"react": "16.2.0",
"react-native": "0.52.0",

xcode:

2018-01-10 15:54:15.635865 backgroundexample[3900:1884257] [] __nw_connection_get_connected_socket_block_invoke 146 Connection has no connected handler
2018-01-10 15:54:17.134563 backgroundexample[3900:1884258] [] __nw_connection_get_connected_socket_block_invoke 147 Connection has no connected handler
2018-01-10 15:54:17.629791 backgroundexample[3900:1884329] [] __nw_connection_get_connected_socket_block_invoke 148 Connection has no connected handler

@vincentsong
Copy link

Anyone got a workaround?? It's still happened on my iOS device.

@vovkasm
Copy link
Contributor

vovkasm commented Jan 16, 2018

I just implement partial workaround for this. See #17617
It adds Enable/Disable DevTools setting to In-App Developer Menu.

But unfortunate it's not enough. Especially because other websocket created in RCTPackagerConnection (funcition socketForLocation) and as I can see it can't be disabled from AppDelegate :-(

I probably can add another item to In-App Developer Menu to Enable/Disable connection to packager. What do people thinking? May be I'm missing something?

@zoi-aoba
Copy link

I understand this problem.....
the "nw_connection_get_connected_socket" error will not appear if you update your setting(https://github.com/facebook/react-native/issues/10027#issuecomment-261608678).

but, still you can not connect, check your smartphone and desktop are connected on same network......

@gazzwi86
Copy link

Is there any movement on this error? I'm still receiving the following errors, and I'm wondering if it is having any effect on connectivity for my included framework?

Produced on RN: 51, 52 & 53, on a fresh project, promptly ejected

2018-02-26 10:35:30.461406+0000 AwesomeProject[1116:328205] NSURLConnection finished with error - code -1001
2018-02-26 10:35:30.475292+0000 AwesomeProject[1116:328202] Task <B8745B69-267D-47AB-BCE2-B4DD3C525418>.<0> HTTP load failed (error code: -999 [1:89])
2018-02-26 10:35:30.479 [info][tid:main][RCTCxxBridge.mm:210] Initializing <RCTCxxBridge: 0x1c41c6540> (parent: <RCTBridge: 0x1cc0cdc10>, executor: (null))
2018-02-26 10:35:30.483170+0000 AwesomeProject[1116:328126] Initializing <RCTCxxBridge: 0x1c41c6540> (parent: <RCTBridge: 0x1cc0cdc10>, executor: (null))
2018-02-26 10:35:30.554 [warn][tid:main][RCTBridge.m:120] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2018-02-26 10:35:30.554183+0000 AwesomeProject[1116:328126] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2018-02-26 10:35:30.578 [warn][tid:main][RCTModuleData.mm:69] Module RCTImageLoader requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2018-02-26 10:35:30.577913+0000 AwesomeProject[1116:328126] Module RCTImageLoader requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2018-02-26 10:35:30.657 [info][tid:main][RCTRootView.m:302] Running application AwesomeProject ({
    initialProps =     {
    };
    rootTag = 1;
})
2018-02-26 10:35:30.657524+0000 AwesomeProject[1116:328526] [] nw_connection_get_connected_socket 2 Connection has no connected handler
2018-02-26 10:35:30.657537+0000 AwesomeProject[1116:328526] TCP Conn 0x1d0360d80 Failed : error 0:61 [61]
2018-02-26 10:35:30.790 [info][tid:com.facebook.react.JavaScript] Running application "AwesomeProject" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

@coreform
Copy link

This still exists with RN 0.52.0 and 0.54.0-rc.3.
I also observe debug mode app falling into a loop where a ton of logs regarding 'memoized props' (something like that) are spewed out to Xcode log view, device overheats (iphone 7), then app crashes.

@knopp
Copy link

knopp commented Mar 7, 2018

Well, this is till an issue. iOS 11, react 0.54.

Rebinding symbol does not seem to work on device, none of the replacement methods are called. It also bothers me that there are two websockets trying to connect to localhost despite running on device.

@ethanyuwang

This comment has been minimized.

@hramos hramos changed the title "__nw_connection_get_connected_socket_block_invoke Connection has no connected handler" error on iOS 10 "__nw_connection_get_connected_socket_block_invoke Connection has no connected handler" in logs Mar 28, 2018
@hramos hramos added Platform: iOS iOS applications. Platform: macOS Building on macOS. labels Mar 28, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Mar 28, 2018
@hramos hramos reopened this Mar 28, 2018
@hramos hramos added Help Wanted :octocat: Issues ideal for external contributors. and removed Platform: macOS Building on macOS. labels Mar 28, 2018
@hramos hramos removed the Bug Report label Feb 6, 2019
@cortinico
Copy link
Contributor

Hey,
We're cleaning up the React Native issue tracker to make sure we focus on the most important issues first.

I'm closing this one because it's stale and related to a version of React Native we no longer support. If the issue persists on the latest version, please re-open a new issue and reference this one.

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Priority: Low
Projects
None yet
Development

No branches or pull requests