react-native: "__nw_connection_get_connected_socket_block_invoke Connection has no connected handler" in logs
Workaround
Edit by @hramos, maintainer:
Several solutions have been presented in this thread:
OS_ACTIVITY_MODE
- Open Xcode.
- Open Product menu.
- Select Edit Scheme…
- Add the following under Environment Variables:
Name:
OS_ACTIVITY_MODE
Value:disable
- 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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 175
- Comments: 133 (22 by maintainers)
Links to this issue
Commits related to this issue
- Adds hacky command line thing to remove annoying error. Per https://github.com/facebook/react-native/issues/10027#issuecomment-296504476 — committed to GridPlus/gridplus-login by alex-miller-0 7 years ago
- Remove annoying message in xcode. See https://github.com/facebook/react-native/issues/10027 — committed to mlandauer/thats-camping-react-native by mlandauer 7 years ago
Hi, guys! This works for me (on simulator):
What’s wrong with people closing this issue ? Disabling the error in output console is not a solution. What’s causing the problem, what’s going on ? Is this an error or a warning ? Why all these same outputs (with an increment) are showing indefinitely ? I think that’s the only relevant point. Tell me if I’m wrong…
Disabling the console to hide the issue shouldn’t be an option for anyone. Closing your eyes also stops you from seeing the warnings.
The solution from HADB above worked for me, but it’s missing a few steps in XCode8, which are added here for clarity:
i got it solved by xcode menu commands: product -> clean and (hold down option key) product -> ‘clean build folder’
Hi @javache I would kindly disagree with your point of view. Indeed many of us are aware that disabling OS logging will prevent this to show. But this also prevent us to do normal debugging of our apps… Just again last week our team had an issue and it took us for ever until we remember to reactivate the os logs to catch the error and sort our issue…
You can silence the error with OS_ACTIVITY_MODE, this is just spurious logging from the websocket we open to React Devtools.
that is not an problem.
Please reopen the issue. Sweeping the error under the carpet doesn’t sound like a solution at all.
Also happening with iOS 10.0.1 and RN 0.30
edit: I followed the recommendations here and am no longer getting the messages
@HADB still fails on device for me
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.
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.
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…I got the logs to go away by setting up react-devtools. Here are the steps (using React v0.48):
npm install -g react-devtools
react-devtools
+1 ios 10.0.1 RN 0.33
@fgaleano SOLUTION = INSTALL REACT-DEVTOOLS 😉
Not an XCode workaround, but this alleviated the pain for me when using the terminal.
react-native log-ios | grep -v __nw_connection_get_connected_socket_block_invoke
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.@cmaitchison suggestion does the trick but in my case, the __ at the start are not needed
react-native log-ios | grep -v nw_connection_get_connected_socket_block_invoke
Commenting +1 is not helpful here, so please stop doing that. Per https://twitter.com/xenadu02/status/776669668404629504 this is a simulator issue, which should be resolved in a future update.
@pietgk No such luck with that solution for me.
OS_ACTIVITY_MODE=disable
works but it’s more of a nuclear option given that it hides all your NSLog statements when running on a device. Perhaps it’s better to just live with the log pollution for now when running on device.Please reopen this. I am unable to reload and debug on device.
@lrettig it’s actually needed when debugging on a real device.
There is a pull request in order to make the IOS native code fill in the local IP (of the debugger machine): https://github.com/facebook/react-native/issues/14431
It sounds stupid to require editing a JS module code to prevent this log pollution. the OS_ACTIVITY_MODE solution became useless with IOS 11, as it blocks all NSLog statements, not only system logs. In our case, no log anymore - which I had a hard time linking to this hack I put in place before! Like someone else said, a hack is not good. A proper fix is required. This is more than an inconvenience when trying to debug stuff 😦
I will second that this was a react-devtools problem for me. Once I installed them, I had all messages immediately stop. Here are the installation instructions: https://github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md
still have the same issue with RN 0.40 and XCode 8.2.1
I get this when I have both remote debugging and console debugging (via
react-native log-ios
). Disabling remote debugging solves the problem.Below RCTWebSocket target’s compiler settings works for me.
+1
Anyone got a workaround?? It’s still happened on my iOS device.
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
To expand on the explanation from @javache, this error is from the websocket that is built into react-native to connect to the react-devtools. If you aren’t running react-devtools while debugging, then you will get this error, and it also pumps a bunch of messages across the bridge complaining about not being able to open the websocket (you will only see those errors if you are using something like rn-snoopy).
The error will stop as soon as you install and open react-devtools. See these instructions for how to do it: https://github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md
Disabling the output means I can’t debug anything else. This should be reopened!!!
Got this error when my phone was not connected to Wifi… 🙈
+1
+1
+1
+1
+1
+1 not possible to fetch() remote json data on ios10 w/ RN 0.33
Sadly it still exists.
Xcode:
Same issue. RN: 0.49.3 Running iOS 11 Xcode 9 Real device
It is a bug that the warning even displays on newer ios versions. So this isn’t actually hiding anything useful. The socket reconnection only happens on debug builds and never on release builds. It is all optionally compiled with the RCT_DEV flag.
If this chnage causes any problems I am more than willing to remove it but currently it hides an issue that was annoying a lot of developers.
I just implement partial workaround for this. See https://github.com/facebook/react-native/pull/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
(funcitionsocketForLocation
) and as I can see it can’t be disabled fromAppDelegate
😦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?
So it was react-devtools all along?? They should put that in HUGE BLACK LETTERS!
It’s indead react-devtools problem, as soon as I start it up, the annoying logs stops.
@javache Running iPhone 5 with iOS 10.2, physical device getting this issue
@javache
libnetwork.dylib
itself is definitely Apple fail, I have to say that uncontrolled spam in console is personally RN behaviour. If I do not dumb things, I should not see console errors every 2 secs.Note for RN devs: Source of problem, is reconnection logic in
RCTWebSocketObserver
(at least in RN 0.42.3) or in the[RCTDevMenu packagerURL]
. Methodreconnect
spam OS with periodic retries. Most wonderful for me was the fact that it try to connect to ‘http://localhost.8081/message’ from real device.Guys, please reopen this issue. Thanks.
+1 Xcode 8.2.1 RN: 0.40
I have the same project on 2 Macs, stopped working on the one where I had to reinstall node/npm (and therefore all the global dependencies). It still works fine on the other one (however, could not get it working on a real iPhone). So to me it looks like something unrelated to Xcode/iOS.
Update: after cleaning node_modules and npm i, working fine, life’s back to normal 😃
Well, sort of 😃 still getting these every second, the app seems to be working though. __nw_connection_get_connected_socket_block_invoke 60 Connection has no connected handler
And it’s gone now. As unexpected and unexplained as it came.
+1 iOS 10.2 RN 0.35
@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:@aleclarson I agreed with the log part but react-native still fail to fetch the bundle file on IOS 10
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.
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
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…
I have confirmed the same issue in the following env: iOS: 10.3.3 (real device) React Native: 0.48 Xcode:9.0 And the app runs really SLOW.(It wasn’t)
HOWEVER, when in Xcode --> Product --> Schema --> Edit Schema --> Info Tab --> Build Configuration --> set from Debug to ‘Release’ Run App again, the Error message is gone, and the app works as expected. Of course, this IS NOT a solution of any sort, but I just want to share this and maybe give a tiny push to the REAL solution. Happy coding!
Thanks @takameyer. Note: just running react-devtools works for me, no need to edit
setupDevtools.js
.Still seeing this error as of react-native 0.48.3. Ignoring errors is a hack, not a solution!
@matthiasdilger **Got it working on device and simulator now by reassigning all signing certificates and entitlements in the project.
Xcode 8.0, ios10, iphone 5s** how you did that please; thank you
After some thinking, this is bad idea at all.
I strongly believe that developer experience with react-native would be better with more transparent and clear code and behavior, not with more and more layers of workarounds.
It is resonable workaround. It would be very good also to have react-devtools functional optional.
https://github.com/facebook/react-native/commit/878b7e42fae990df745af2db6ac50cbac8a8ce1c removes this log message in development by redirecting an internal apple log function.
@andreyslyusar nohow, Xcode has not any filters in console 😦, also some advanced filters exists in Console application on Sierra.
But grep still most powerful way to do filtering to me, so I use iOS Console, it contains command line application inside bundle. So I can do
/Applications/iOS\ Console.app/Contents/Resources/iosconsole | egrep anything
from terminal.Does anyone foresee a real solution to this instead of just turning off logs? My OCD goes insane at this issue but also about turning off logging. Am I the only one?
Did someone say that typing 👍 works well? :trollface:
This is happening on a real device. I could disable the messages, but it sounds like a thing that requires fixing / explaining.
So if you recognize it as an problem that should be fixed in a future update, why not keep this issue open to reflect your position on this?
I am getting this error/warning when using fetch to my api on the net, bundle loads properly(ios10.3/RN 0.43-rc4). Server receives the request and sends the response but RN never receives the response. So my real issue here is not receiving the response and not about the warnings.
+1 iOS 10.2 RN 0.35
+1
@DrBeak1
Still an issue with: RN 0.34 XCode 8.0 iOS 10.0 simulator
It’s working with the iOS 9.2 simulator, however.