aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 885 forks source link

Crash -[AWSIoT] on nw_connection_get_connected_socket_block_invoke #599

Closed HAKASHUN closed 7 years ago

HAKASHUN commented 7 years ago

I've git crashes at AWSIoTDataManager: connectUsingWebSocketWithClientId with no internet access Wi-Fi.

SDK Version: 2.5.0

Our App Code (swift) is below

let dataManager = AWSIoTDataManager(forKey: "USWest2IoTDataManager")
dataManager.connectUsingWebSocketWithClientId(clientId, cleanSession: true) { status in
    print(status)
}

Output Log is below

2017-02-22 09:52:06.500203+0900 MyApp[807:117878] [] nw_connection_get_connected_socket_block_invoke 19 Connection has no connected handler
2017-02-22 09:52:10.573128+0900 MyApp[807:117867] [] nw_connection_get_connected_socket_block_invoke 27 Connection has no connected handler
2017-02-22 09:52:14.632198+0900 MyApp[807:117879] [] nw_connection_get_connected_socket_block_invoke 28 Connection has no connected handler
Message from debugger: Terminated due to memory issue

It happens after "Connection has no connected handler" increases to some extent.

Verbose Output Log is below

2017-02-22 10:08:33.383853+0900 myApp[813:120501] [] nw_connection_get_connected_socket_block_invoke 8 Connection has no connected handler
2017-02-22 10:08:33.384290+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFInputStream: 0x170303e70> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:33.384630+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFOutputStream: 0x1703040b0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:33.392585+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Failing with error 操作を完了できませんでした。接続は拒否されました
2017-02-22 10:08:33.395567+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Trying to disconnect
2017-02-22 10:08:36.632638+0900 myApp[813:120501] [] nw_connection_get_connected_socket_block_invoke 23 Connection has no connected handler
2017-02-22 10:08:36.632834+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFOutputStream: 0x1703060c0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.632930+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFInputStream: 0x170305fa0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.632997+0900 myApp[813:120458] AWSiOSSDK v2.5.0 [Error] AWSIoTMQTTClient.m line:719 | -[AWSIoTMQTTClient webSocket:didFailWithError:] | :( Websocket Failed With Error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.633221+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Failing with error 操作を完了できませんでした。接続は拒否されました
2017-02-22 10:08:36.633246+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Trying to disconnect
2017-02-22 10:08:36.632638+0900 myApp[813:120501] [] nw_connection_get_connected_socket_block_invoke 27 Connection has no connected handler
2017-02-22 10:08:36.632834+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFOutputStream: 0x1703060c0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.632930+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFInputStream: 0x170305fa0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.632997+0900 myApp[813:120458] AWSiOSSDK v2.5.0 [Error] AWSIoTMQTTClient.m line:719 | -[AWSIoTMQTTClient webSocket:didFailWithError:] | :( Websocket Failed With Error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:36.633221+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Failing with error 操作を完了できませんでした。接続は拒否されました
2017-02-22 10:08:36.633246+0900 myApp[813:120501] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Trying to disconnect
2017-02-22 10:08:40.730814+0900 myApp[813:120498] [] nw_connection_get_connected_socket_block_invoke 28 Connection has no connected handler
2017-02-22 10:08:40.731002+0900 myApp[813:120498] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFOutputStream: 0x1703060c0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:40.731064+0900 myApp[813:120498] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] NSStreamEventErrorOccurred <__NSCFInputStream: 0x170305fa0> Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:40.731156+0900 myApp[813:120458] AWSiOSSDK v2.5.0 [Error] AWSIoTMQTTClient.m line:719 | -[AWSIoTMQTTClient webSocket:didFailWithError:] | :( Websocket Failed With Error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}
2017-02-22 10:08:40.731388+0900 myApp[813:120498] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Failing with error 操作を完了できませんでした。接続は拒否されました
2017-02-22 10:08:40.731418+0900 myApp[813:120498] AWSiOSSDK v2.5.0 [Info] AWSSRWebSocket.m line:1724 | void SRFastLog(NSString *__strong, ...) | [SR] Trying to disconnect
Message from debugger: Terminated due to memory issue

The situation of connecting to "no internet access Wi-Fi" is exceptional, but our application temporarily connects to the hardware access point, so we can not ignore this error.

HAKASHUN commented 7 years ago

According to Xcode(8.2.1) log, the crash caused by memory issue.

While my device is connected to XCode, the crash happens. But while my device is not connected to XCode, it not happens...

fengsongAWS commented 7 years ago

Hi @HAKASHUN , Did you mean the App crash happens only when you connect your IOS device to Xcode? The log seems to indicated the connection refused. I am not sure if this is caused by AWS IoT IOS Device SDK. There is a few things you can check.

  1. Could you check if you have the correct cognito pool ID and have the correct policies attached to it? You can find useful information from comment under this issue. https://github.com/awslabs/aws-sdk-ios-samples/issues/150
  2. Do you run into the same error when you run AWS IoT IOS samples? The repo can be found here. https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift
  3. I am not able to duplicate your issues but I found similar issues here https://github.com/facebook/react-native/issues/10027. This is similar error log with react-native. It seems to be related to IOS 10 configuration. Please let us know if this helps to resolve your problem. Thanks
karthiksaligrama commented 7 years ago

assuming resolved. Closing