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

Unable to connect to mqtt, MQTT session error, code: 3 #5467

Closed
mzying2013 opened this issue Nov 23, 2024 · 3 comments
Closed

Unable to connect to mqtt, MQTT session error, code: 3 #5467

mzying2013 opened this issue Nov 23, 2024 · 3 comments

Comments

@mzying2013
Copy link

mzying2013 commented Nov 23, 2024

We have received user feedback regarding issues with connecting to MQTT. Here are the details from two users:

  1. Device Information:
    User 1: iPhone 11, iOS 17.6.1, AWSIoT SDK version 2.36.7
    User 2: iPhone 16 Pro Max, iOS 18.1, AWSIoT SDK version 2.37.2

  2. Issue Reproduction:
    For User 2, we have obtained logs but were unable to reproduce the issue.
    The logs include detailed AWSIoT information, with the following key observation:

[AWSIoTKeychain getIdentityRef:certificateLabel:] 370] getIdentityRef error: -25300

This occurred during a certificate existence check using
AWSIoTManager.isValidCertificate(certificateId)
prior to calling
AWSIoTManager.importIdentity.

  1. Subsequent Behavior:
    The AWSIoTManager.importIdentity method confirmed a successful return.
    However, the connection attempt later failed with the following error:

MQTT session error, code: 3

If you have any suggestions or feedback regarding this issue, please let us know.
Thank you very much!

  1. Log

November 23, 2024 at 12:25:09 AM EST [I AWSIoTDataManager.-[AWSIoTMQTTConfiguration initWithKeepAliveTimeInterval:baseReconnectTimeInterval:minimumConnectionTimeInterval:maximumReconnectTimeInterval:runLoop:runLoopMode:autoResubscribe:lastWillAndTestament:] 179] Initializing AWSIoTMqttConfiguration with KeepAlive:60.000000, baseReconnectTime:1.000000,minimumConnectionTime:1.000000, maximumReconnectTime:8.000000, autoResubscribe:Disabled, lwt topic: message:
November 23, 2024 at 12:25:09 AM EST [E AWSIoTKeychain.+[AWSIoTKeychain getIdentityRef:certificateLabel:] 370] getIdentityRef error: -25300
November 23, 2024 at 12:25:09 AM EST [D AWSIoTDataManager.-[AWSIoTDataManager connectWithClientId:cleanSession:certificateId:statusCallback:port:] 441] <<<NSThread: 0x30270ff40>{number = 10, name = (null)}>>In connectWithClientID
November 23, 2024 at 12:25:09 AM EST [I AWSIoTDataManager.-[AWSIoTDataManager connectWithClientId:cleanSession:certificateId:statusCallback:port:] 442] hostName: a2rac2pr1im2vr-ats.iot.us-west-2.amazonaws.com
November 23, 2024 at 12:25:09 AM EST [I AWSIoTDataManager.-[AWSIoTDataManager connectWithClientId:cleanSession:certificateId:statusCallback:port:] 443] URL: mqtts://a2rac2pr1im2vr-ats.iot.us-west-2.amazonaws.com
November 23, 2024 at 12:25:09 AM EST [I AWSIoTMQTTClient.-[AWSIoTMQTTClient connectWithCert] 303] user metadata is : ?SDK=iOS&Version=2.37.2
November 23, 2024 at 12:25:09 AM EST [I AWSIoTMQTTClient.-[AWSIoTMQTTClient connectWithCert] 305] Metrics collection is: Enabled
November 23, 2024 at 12:25:09 AM EST [I AWSMQTTSession.-[AWSMQTTSession initWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetainFlag:publishRetryThrottle:] 83] -[AWSMQTTSession initWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetainFlag:publishRetryThrottle:] [Line 83], Thread:<NSThread: 0x30270ff40>{number = 10, name = (null)}
November 23, 2024 at 12:25:09 AM EST [D AWSMQTTMessage.+[AWSMQTTMessage connectMessageWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetain:] 66] +[AWSMQTTMessage connectMessageWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetain:] [Line 66], Thread:<NSThread: 0x30270ff40>{number = 10, name = (null)}
November 23, 2024 at 12:25:09 AM EST [D AWSMQTTMessage.+[AWSMQTTMessage connectMessageWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetain:] 104] Creating AWSMQTTMessage with raw data >>>>> {length = 95, bytes = 0x00044d51 54540482 003c003a 696f732d ... 6e3d322e 33372e32 } <<<<<
November 23, 2024 at 12:25:09 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread main] 59] Started execution of Thread: [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]
November 23, 2024 at 12:25:09 AM EST [I AWSMQTTSession.-[AWSMQTTSession connectToInputStream:outputStream:] 127] <<<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}>> Initializing MQTTEncoder and MQTTDecoder streams
November 23, 2024 at 12:25:09 AM EST [D AWSMQTTEncoder.-[AWSMQTTEncoder open] 40] opening encoder stream.
November 23, 2024 at 12:25:09 AM EST [D AWSMQTTDecoder.-[AWSMQTTDecoder open] 43] opening decoder stream.
November 23, 2024 at 12:26:09 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread timerHandler:] 150] Default run loop timer executed on Thread: [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]. isRunning = YES. isCancelled = NO
November 23, 2024 at 12:26:26 AM EST [V AWSMQTTEncoder.-[AWSMQTTEncoder stream:handleEvent:] 58] -[AWSMQTTEncoder stream:handleEvent:] [Line 58] EventCode:8, Thread: <AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}
November 23, 2024 at 12:26:26 AM EST [V AWSMQTTSession.-[AWSMQTTSession encoder:handleEvent:] 339] -[AWSMQTTSession encoder:handleEvent:] [Line 339], eventCode: 1
November 23, 2024 at 12:26:26 AM EST [E AWSMQTTSession.-[AWSMQTTSession error:] 652] MQTT session error, code: 3
November 23, 2024 at 12:26:26 AM EST [D AWSMQTTEncoder.-[AWSMQTTEncoder close] 47] closing encoder stream.
November 23, 2024 at 12:26:26 AM EST [D AWSMQTTDecoder.-[AWSMQTTDecoder close] 50] closing decoder stream.
November 23, 2024 at 12:26:27 AM EST [V AWSIoTMQTTClient.-[AWSIoTMQTTClient session:handleEvent:] 1022] MQTTSessionDelegate handleEvent: 3
November 23, 2024 at 12:26:27 AM EST [E AWSIoTMQTTClient.-[AWSIoTMQTTClient session:handleEvent:] 1080] MQTTSessionEventConnectionError: Received an MQTT session connection error
November 23, 2024 at 12:26:28 AM EST [I AWSIoTMQTTClient.-[AWSIoTMQTTClient reconnectToSession] 724] Attempting to reconnect.
November 23, 2024 at 12:26:28 AM EST [I AWSIoTMQTTClient.-[AWSIoTMQTTClient connectWithCert] 303] user metadata is : ?SDK=iOS&Version=2.37.2
November 23, 2024 at 12:26:28 AM EST [I AWSIoTMQTTClient.-[AWSIoTMQTTClient connectWithCert] 305] Metrics collection is: Enabled
November 23, 2024 at 12:26:28 AM EST [V AWSIoTMQTTClient.-[AWSIoTMQTTClient connectWithCert] 387] Issued Cancel on thread [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]
November 23, 2024 at 12:26:28 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread cancelAndDisconnect:] 104] Issued Cancel and Disconnect = [NO] on thread [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]
November 23, 2024 at 12:26:28 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread main] 59] Started execution of Thread: [<AWSIoTStreamThread: 0x301c96c00>{number = 24, name = (null)}]
November 23, 2024 at 12:26:28 AM EST [I AWSMQTTSession.-[AWSMQTTSession connectToInputStream:outputStream:] 127] <<<AWSIoTStreamThread: 0x301c96c00>{number = 24, name = (null)}>> Initializing MQTTEncoder and MQTTDecoder streams
November 23, 2024 at 12:26:28 AM EST [D AWSMQTTEncoder.-[AWSMQTTEncoder open] 40] opening encoder stream.
November 23, 2024 at 12:26:28 AM EST [D AWSMQTTDecoder.-[AWSMQTTDecoder open] 43] opening decoder stream.
November 23, 2024 at 12:26:37 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread cleanUp] 140] Skipping disconnect for thread: [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]
November 23, 2024 at 12:26:37 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread main] 94] Finished execution of Thread: [<AWSIoTStreamThread: 0x301c63f80>{number = 14, name = (null)}]
November 23, 2024 at 12:27:28 AM EST [V AWSIoTStreamThread.-[AWSIoTStreamThread timerHandler:] 150] Default run loop timer executed on Thread: [<AWSIoTStreamThread: 0x301c96c00>{number = 24, name = (null)}]. isRunning = YES. isCancelled = NO

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 23, 2024
@mzying2013
Copy link
Author

Users can access HTTPS services on Amazon; is it possible that they might be unable to access MQTTS services?

@mzying2013
Copy link
Author

It is indeed a network issue. If you also encounter the same log error, please prioritize considering whether the user's network has a problem.

@github-actions github-actions bot removed pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 25, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant