Network connection was lost error - swift

I am trying to connect into realm object server from an app developed with swift on macos
When I try to connect, I get this error "Network connection was lost", but I can open the realm server from the browser without a problem.. btw, this problem happened recently, it was working correctly few weeks ago
let credentials = SyncCredentials.usernamePassword(username: username, password: password)
SyncUser.logIn(with: credentials, server: serverurl) {
user, error in
if let u = user {
onCompletion(syncUser: u, error: nil)
} else if let error = error {
onCompletion(syncUser: nil, error: error)
} else {
onCompletion(syncUser: nil, error: nil)
}
}
Here, user is always nil and the error description is Network connection was lost
This happens with both a local server and one hosted on digitalocean
Server version 1.8.3
xcode console log
2018-01-15 12:46:07.077741+0300 Oncobase[8138:9497304]
ApplePersistence=NO 2018-01-15 12:46:07.207859+0300
Oncobase[8138:9497813] dnssd_clientstub ConnectToServer: connect()->
No of tries: 1 2018-01-15 12:46:08.218889+0300 Oncobase[8138:9497813]
dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
2018-01-15 12:46:09.228932+0300 Oncobase[8138:9497813]
dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
2018-01-15 12:46:10.239595+0300 Oncobase[8138:9497813]
dnssd_clientstub ConnectToServer: connect() failed
path:/var/run/mDNSResponder Socket:16 Err:-1 Errno:1 Operation not
permitted 2018-01-15 12:46:10.239850+0300 Oncobase[8138:9497813] []
nw_resolver_create_dns_service_locked
DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563)
2018-01-15 12:46:10.240322+0300 Oncobase[8138:9497813] TIC TCP Conn
Failed [1:0x600000163300]: 10:-72000 Err(-65563) 2018-01-15
12:46:10.257327+0300 Oncobase[8138:9497796] Task
.<1> HTTP load failed (error
code: -1003 [10:-72000]) 2018-01-15 12:46:10.257548+0300
Oncobase[8138:9497796] Task .<1>
finished with error - code: -1003 2018-01-15 12:46:23.852072+0300
Oncobase[8138:9497838] [] nw_socket_connect connectx failed (fd 16,
127.0.0.1:9080 stream, pid: 8138, sanitized url: http://127.0.0.1:9080/auth): [1] Operation not permitted 2018-01-15
12:46:23.852142+0300 Oncobase[8138:9497838] []
nw_socket_get_input_frames recvmsg(fd 16, 1024 bytes): [57] Socket is
not connected 2018-01-15 12:46:23.852284+0300 Oncobase[8138:9497838]
TIC TCP Conn Failed [2:0x600000169b40]: 1:57 Err(57) 2018-01-15
12:46:23.852618+0300 Oncobase[8138:9497838] Task
<91597B31-6AB4-41BB-A5A6-C32525BC8A67>.<2> HTTP load failed (error
code: -1005 [1:57]) 2018-01-15 12:46:23.853839+0300
Oncobase[8138:9497798] Task <91597B31-6AB4-41BB-A5A6-C32525BC8A67>.<2>
finished with error - code: -1005
Edit 1: I have just enabled sandboxing to be able to upload the app into apple app store.. could this be the issue? any workaround?

It seems sandboxing was the real problem
I had to enable Ingoing Connections and Outgoing Connections with sandboxing for this to work

You have to off the "App Sandbox".
Go to: xcode Project-> Capabilities -> App SandBoxScreenShot

Related

What is causing this Flutter Firestore error on macOS?

I'm trying to create a simple document in my Firestore database when a user presses submit. It works when the app is run on iOS but this is what I see when I run it on macOS:
2022-03-20 19:39:47.333823-0700 globe_artist[62624:775059] Connection 12: received failure notification
2022-03-20 19:39:47.333872-0700 globe_artist[62624:775059] Connection 12: failed to connect 1:1, reason -1
2022-03-20 19:39:47.333901-0700 globe_artist[62624:775059] Connection 12: encountered error(1:1)
2022-03-20 19:39:47.337548-0700 globe_artist[62624:775059] Task <3286828D-3FE8-44EB-9E85-C164E1B00836>.<1> HTTP load failed, 0/0 bytes (error code: 1 [1:1])
2022-03-20 19:39:47.338184-0700 globe_artist[62624:775059] Task <3286828D-3FE8-44EB-9E85-C164E1B00836>.<1> finished with error [1] Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3286828D-3FE8-44EB-9E85-C164E1B00836>.<1>, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <3286828D-3FE8-44EB-9E85-C164E1B00836>.<1>"
), _NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, dns}
2022-03-20 19:40:19.959305-0700 globe_artist[62624:775842] [] nw_path_evaluator_create_flow_inner NECP_CLIENT_ACTION_ADD_FLOW A50B5D10-DA1B-457F-9F74-3EAC1A8BA7A6 [1: Operation not permitted]
2022-03-20 19:40:19.959890-0700 globe_artist[62624:775842] [connection] nw_endpoint_flow_setup_channel [C13.1 142.250.217.106:443 in_progress channel-flow (satisfied (Path is satisfied), interface: en0, ipv4, dns)] failed to request add nexus flow

Hyperledger Fabric on Kubernetes - Restarting Peer throw error for few minutes

I have setup for 3 organisations on Kubernetes cluster and it is giving me following error when I restart peer node pod and tried command -> peer channel list on bash shell,
[comm.tls] ClientHandshake -> ERRO 026 Client TLS handshake failed after 2.997205009s with error: context canceled remoteaddress=10.0.94.178:7051
[grpc] WarningDepth -> DEBU 027 [core]grpc: addrConn.createTransport failed to connect to {peer0-org1:7051 peer0-org1:7051 <nil> 0 <nil>}. Err: connection error: desc = "transport: authentication handshake failed: context canceled". Reconnecting...
Error: error getting endorser client for channel: endorser client failed to connect to peer0-org1:7051: failed to create new connection: context deadline exceeded
After some time (nearly 10-15 minutes) if I tried same command,
[comm.tls] ClientHandshake -> DEBU 024 Client TLS handshake completed in 1.48399ms remoteaddress=10.0.94.178:7051
[grpc] InfoDepth -> DEBU 025 [core]Subchannel Connectivity change to READY
It seems working and give me channel list. I am not able to find out what is reason behind this, Please help for this.

Safari Extension Fails to perform URLSession Tasks with error: failed path:/var/run/mDNSResponder Operation not permitted

Hi guys I attempts to make RESTful call when toolbar item is click.
then it fails to connect to the internet with the following error in log.
[default] Unable to load Info.plist exceptions (eGPUOverrides)
The extension's toolbar item was clicked
dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:5 Err:-1 Errno:1 Operation not permitted
Error: Optional(Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x600003e3c4b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, NSErrorFailingURLStringKey=https://some_valid_url, NSErrorFailingURLKey=https://some_valid_url, _kCFStreamErrorDomainKey=10, _kCFStreamErrorCodeKey=-72000, NSLocalizedDescription=A server with the specified hostname could not be found.})
[] nw_resolver_create_dns_service_locked [C1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563)
TIC TCP Conn Failed [1:0x60000051d200]: 10:-72000 Err(-65563)
Task <D9356F42-2832-426A-9FE6-C37C0A22F954>.<1> HTTP load failed (error code: -1003 [10:-72000])
Task <D9356F42-2832-426A-9FE6-C37C0A22F954>.<1> finished with error - code: -1003
Program ended with exit code: 0
So then I tried:
Turn on App sandbox and tick both incoming and outgoing connection
Does not work, same error
Turn off App sandbox
Extension disappears in safari preferences
No response when I click "Open in Safari Extensions Preferences"
My config:
Xcode: Version 10.1 (10B61)
Mac: Mojave 10.14.2(18C54)
Safari: 12.0.2(14606.3.4)
Any ideas?
You may need to enable Incoming and Outgoing connections on the app Sandbox to let your requests go thru.

mount_smbfs fails to connect

I am trying to mount a remote drive to copy few files. I was originally doing this using a shell script. This is working fine and I was able to copy files.
Now I wrote a GUI tool using swift , Inside the mac osx app I load the shell script and run it using Process. The script is loading fine and its receiving the arguments I pass and also it rans. But when it tries to execute this like it errors,
mount_smbfs $path ~/buildboxshare/
mount_smbfs $destpath ~/internalsiteshare
where path is,
//user#ob1-server/Share/ios/DEV/build/Version_4.0.23.0
I am getting this error back,
2018-11-27 17:12:01.912649+0000 mount_smbfs[60333:30411307]
dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
2018-11-27 17:12:02.917815+0000 mount_smbfs[60333:30411307]
dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
2018-11-27 17:12:03.920862+0000 mount_smbfs[60333:30411307]
dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
2018-11-27 17:12:04.922161+0000 mount_smbfs[60333:30411307]
dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:4 Err:-1 Errno:1 Operation not
permitted mount_smbfs: server connection failed: No route to host

How to enable web traffic for UI test bundle? (XCTest, XCode - DNSServiceCreateConnection failed)

When I use http/https communication from integration tests (unit test bundle) it's working. However when I use the same code in UI test bundle, I've got the following error trace:
Request Content:
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
XCTRunner[6389:1020209] [] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)
XCTRunner[6389:1020209] [] __nw_connection_get_connected_socket_block_invoke 2 Connection has no connected handler
XCTRunner[6389:1020207] PAC stream failed with
XCTRunner[6389:1020208] [] nw_proxy_resolver_create_parsed_array PAC evaluation error: kCFErrorDomainCFNetwork: -72000
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:7 Err:-1 Errno:1 Operation not permitted
XCTRunner[6389:1020208] [] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)
I have opened a Technical Support Incident at Apple and they answered that this is a bug from their side.
Kindly asked me to open a ticket in their bug report system.
The ticket is opened since 20-Dec-2016. Hopefully they will solve it as soon as possible.
Meanwhile I found a workaround for this.
I've put:
#if DEBUG
// cleaning server configuration
#endif
in the production code and I'm doing there the necessary cleaning operations. This code will translated in the production code if it's built in debug mode.