-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Xcode 10 runtime warning on fresh install: nw_socket_handle_socket_event #21030
Comments
UPDATE This only happens when I run it on an iOS 12 device!!! (Doesn't matter what I build with) Reverting back to iOS 11 for now. |
same issue with 0.57.0 version:
|
Is this resolved? I'm also seeing messages like: |
Temporary fix: Edit Scheme => Run => Environment Variables => Add |
This works fine, but keep in mind that it also suppresses all NSLog output you may need for debugging. |
I also have the same problem, it keeps running and the memory is getting big and big, when it reached 15G, my computer crushed |
Any info on this? I am too seeing a spew of these errors in debug output when running my app on a device. I haven't tracked memory consumption on the device yet but I will do that soon to see if this is a show-stopping issue that would prevent me from releasing my app. EDIT: While I haven't seen me any absurd memory growth, it is chewing through an abnormal amount of CPU while in this cycle of establishing connections. |
This comment has been minimized.
This comment has been minimized.
I also having same issue with xcode 10 and IOS12 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am receiving this error ReactProject[12849:185872] [] nw_connection_get_connected_socket [C62] Client called nw_connection_get_connected_socket on unconnected nw_connection and my computer becomes completely slow while running it. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
The same problem for me on Xcode 10 iOS 12 Simulator.
This fixes the issue on iOS 12 Simulator. Could someone explain what this does? I will test later on iOS 11. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hey all - “Same” and “+1” are not particularly helpful for this discussion. |
Weird, doing rm -rf $TMPDIR/react-* && watchman watch-del-all && yarn cache clean worked for me. Maybe it wouldn't hurt to add a |
This comment has been minimized.
This comment has been minimized.
If someone is looking for temporary get rid of this issue then apply filter in XCode console with So we can see our required debug log.. 😆 |
This comment has been minimized.
This comment has been minimized.
please stop commenting with +1/"me too". It's more frustrating than helpful. about this issue, it's caused by Apple changing the error messages in their network stack making our fishhook logic no longer work. (Found here: https://github.com/facebook/react-native/blob/master/Libraries/WebSocket/RCTReconnectingWebSocket.m) @maicki do you have any spare cycles to take a look at getting this working? |
No idea if this helps, but just an observation -- when I see this issue, I can watch the number of ports being reported for Xcode via Activity Monitor keeps climbing. On my Mac Pro trashcan, OSX will eventually become unusable and crash, usually when the ports climb to around 200,000. Looks like the number of ports grows by about 20 every 2 seconds. I don't see any odd data via netstat or lsof. Hardly any CPU usage for me, just the ports slowly climbing and eventually OSX crashing and requiring a power cycle to recover. |
…atic bundles. (facebook#24050) Summary: For the use-case where iOSdebug builds prefer to use static bundles over bundles served dynamically by metro. There's currently a bug caused by the packager client repeatedly attempting to connect to metro. This leads to endless log statements in xcode as well as other side effects: facebook#21030. Fix is based off of facebook#21030 which fixes the behavior for the inspector. Stops endless logging by packager client for debug builds that use static bundles. [CATEGORY] [TYPE] - Message Pull Request resolved: facebook#24050 Differential Revision: D14541574 Pulled By: cpojer fbshipit-source-id: 09c2c82eb2d4aeb0e7ba322fd81b0dd7bf9e683c
For me, @dembe1's solution didn't work since I'm using Electrode Native and we don't have that in our AppDelegate.m. However, we don't use sockets in our react-native app so I went to the source of the reconnections and prevented them from happening. On RN
This removed all those annoying reconnect logs. This change is a bit overkill, I'm sure commenting out the UPDATE: For my team members, that wasn't enough. I also had to remove the After that, no more logs. |
I'm using react native 0.59.5 and I'm getting these errors. However this version of react native uses: |
Having the same issue on iOS 12.1.4, react-native: 0.59.5, XCode 10.2.1. Runs many times:
Any updates? |
Was having the same issue on:
Looking at the comments on a number of posts I was able to resolve the issue by applying pretty much the same fix to AppDelegate.m. First of all, I'm terribly new to Objective-C so I'm sure this could be prettier, but its effective:
|
@kenjdavidson thanks, it works perfectly! Just you can optimize the code a little bit by reusing the jsUrl variable:
|
#24023 (comment) @patrickkempff 's solution possibly help |
I'm also on 0.59.8 and the latest iOS and Xcode. My workaround looks like this: - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
NSURL *jsUrl = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[[RCTBundleURLProvider sharedSettings] setJsLocation:jsUrl.host];
return jsUrl;
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
} The errors are gone while I do have a JS debugger open, but
just repeats indefinitely while I'm not debugging JS. So I guess the solution isn't working for me :( |
@noahtallen, @IAmMarcellus I’ve found moving the [[RCTBundleURLProvider sharedSettings] setJsLocation:[self sourceURLForBridge:bridge].host]; I added the line directly after the |
@DShepherd Huh. I just tried that and the logs still show up for me |
Did all of the above, but did not really work. Then I noticed a CORS error in the Chrome debugger. Switched to React Native Debugger (https://github.com/jhen0409/react-native-debugger), rebuild the app, and it started working on my device. The cors error prevented from connecting to the socket i guess I hope this could be helpful to someone. To summarize what I did:
While the app is running, you should not see any socket connection errors again in the logs AppDelegate.m
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.h>
#import <AppCenterReactNativeAnalytics/AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNative/AppCenterReactNative.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"
// iOS 9.x or newer
// https://facebook.github.io/react-native/docs/linking
#import <React/RCTLinkingManager.h>
@implementation AppDelegate
// https://facebook.github.io/react-native/docs/linking
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Custom added
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:false];
[AppCenterReactNative register];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"MyApp"
initialProperties:nil];
// Custom editted
// Original:
// rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
rootView.backgroundColor = [UIColor blackColor];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
// Custom added
[RNSplashScreen show];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
// Custom added:
// This prevents the logs from constantly showing websocket connection errors
// https://github.com/facebook/react-native/issues/21030#issuecomment-493392051
// original:
// return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
NSURL *jsUrl = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[[RCTBundleURLProvider sharedSettings] setJsLocation:jsUrl.host];
return jsUrl;
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
|
I'm also using react native debugger (which works great like you say!), but the logs show up for me when I turn off remote JS debugging |
@dembe1 solution from Mar 10 worked for me. He gives an excellent explanation of this issue btw! |
Summary: (Together with a pr to react-devtools) Fixes facebook/react-native#21030 [iOS] [Fixed] - Fix infinite retry loop of inspector Pull Request resolved: facebook/react-native#22625 Differential Revision: D14169392 Pulled By: hramos fbshipit-source-id: 2e301fd9d458598b62399fc61a9859ad29928483
Summary: (Together with a pr to react-devtools) Fixes facebook#21030 [iOS] [Fixed] - Fix infinite retry loop of inspector Pull Request resolved: facebook#22625 Differential Revision: D14169392 Pulled By: hramos fbshipit-source-id: 2e301fd9d458598b62399fc61a9859ad29928483
The same problem is still present even on |
Okay on 0.59.9 cleaning up the build folder and rebuilding the app helps. If you need a debuger, https://github.com/jhen0409/react-native-debugger works as @jvandenaardweg suggested (chrome debugger shows CORB errors). The annoying thing is that even with the app working and debugger working I see a neverending stream of errors in xcode console:
I mean, what exactly is it trying to connect to? The Metro bundler works properly and the debugger is connected, what's happening? |
I think fb uses quite a different debug setup internally, and it's supposed to connect to that. |
Kinda ridiculous, that everyone is struggling with the tools rather than the actual appplication code. |
Xcode 11, IOS13, RN 0.57.8
|
Possible solution: Check if your mac and phone are on the same wifi network lol :((. |
of cause it is |
it still exists in react-native@0.61.2. i have try each solution above, but don't work for me. Is there a perfect solution to this problem? |
For people complaining about "me too" and +1s, don't say it is not useful because it is, nobody is looking at this issue and the bot will just close the issue if there's no reply. So yes, keep the issue alive, github will hide similar messages. |
FWIW, I was a hitting different issue that led me here. Specifically, when running on an actual iOS device, I was receiving a red-box message that "Connection to http://my-ip-address:8081/debugger-proxy?role=client timed out. Are you running node proxy? If you are running on the device, check if you have the right IP address in I noticed that this issue occurred when I switched between two different networks (call them A and B). When running on network B, the IP address in the message above was from network A. I finally figured out that if I delete the test application from the iOS device, then re-run, the app would then correctly use network B and the issue was resolved. So, now I know that when I change networks, I simple delete the test app (and its data) to resolve this issue. There is probably a more precise way to resolve this, but deleting the app worked fine for me. Clearly something on the iOS device is remembering the IP address from a different network and trying to reuse it. Hopefully this post will save someone some time! |
Description
While running the boilerplate react native app, I receive the runtime error:
2018-09-09 21:46:07.681496-0400 client[2035:560210] [] nw_socket_handle_socket_event [C6.2:1] Socket SO_ERROR [61: Connection refused] 2018-09-09 21:46:07.681861-0400 client[2035:560216] [] nw_connection_get_connected_socket [C6] Client called nw_connection_get_connected_socket on unconnected nw_connection 2018-09-09 21:46:07.681903-0400 client[2035:560216] TCP Conn 0x2821ac300 Failed : error 0:61 [61]
which loops over and over for the duration of debugging the app on a device. I'm not sure exactly what this error is associated with, however in my other app I receive the same error. This may or may not be related to remote push notifications (APNs).
Environment
React Native Environment Info: System: OS: macOS 10.14 CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 27.59 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 9.8.0 - /usr/local/bin/node Yarn: 1.5.1 - /usr/local/bin/yarn npm: 5.6.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3 IDEs: Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild npmPackages: react: 16.4.1 => 16.4.1 react-native: 0.56.0 => 0.56.0 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1
Reproducible Demo
A couple of notes:
react-native run-ios
builds using Xcode 9.4.1The text was updated successfully, but these errors were encountered: