Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] [Paho Mqtt C Client]: Automatic Reconnect does't work Some times

Hi Ian,

I am using Paho Mqtt C Client on my device to send event some notifications.I am facing issues with the automatic reconnect functionality.It is not working sometimes[2 out 10 times] when i plug out the ethernet cable from my device.

I have attached two log files here for the successful and failure cases for your reference.For the successfull case ,u can see the below prints which confirms that it is retrying to connect.

Debug: Connect failed, rc 0 (connect failure callback prnts)

But for the Failure case these prints are not coming which means it is not retying and connect failed callback is not getting called.

Code Details:
    conn_opts.keepAliveInterval = 5;
    conn_opts.cleansession = 1;
    conn_opts.automaticReconnect = 1;
    conn_opts.connectTimeout = 3;
    conn_opts.minRetryInterval = 4;
    conn_opts._onSuccess_ = onConnect;
    conn_opts._onFailure_ = onConnectFailure;

void onConnectFailure(void* context, MQTTAsync_failureData* response)
{
    DEBUG("Connect failed, rc %d\n", response ? response->code : 0);
}

#define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 4, 60, 1, 10, NULL, NULL, NULL, 30, 0, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 1, 60}

Kindly help me with this issue.Let me know if we need to modify the conn_opts values.

Thanks

20170721 055726.097 4 MQTT_TEST -> PINGREQ (0)
20170721 055726.198 received 0 256 buflen 5
20170721 055726.483 4 MQTT_TEST <- PINGRESP


libphy: 2188000.ethernet:02 - Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready


20170721 055732.992 sent 0 256 buflen 5
20170721 055732.992 4 MQTT_TEST -> PINGREQ (0)
20170721 055735.594 sent 0 256 buflen 5
20170721 055735.594 4 MQTT_TEST -> PUBLISH msgid: 2 qos: 1 retained: 0 (0) payload: [{                

socket-closed, reconnecting

20170721 055739.601 PINGRESP not received in keepalive interval for client ELIKA_TEST on socket 4, disconnecting
20170721 055739.700 sent 0 256 buflen 5
20170721 055739.700 4 MQTT_TEST -> DISCONNECT (0)
20170721 055740.701 sent 0 256 buflen 5
20170721 055740.701 sent 771 21 buflen 2

20170721 055740.701 SSL alert write:warning:close notify
Debug: Send Failed [-11]
Debug: Connection lost
Debug: Cause: (null)
Debug: Reconnecting

Error: Failed to publish Event data.
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev- instead.

20170721 055744.707 getaddrinfo failed for addr <host-addr> with rc -2
20170721 055744.707 <host addr> is not a valid IP address
20170721 055744.712 getaddrinfo failed for addr <host addr> with rc -2
20170721 055744.712 <host addr> is not a valid IP address

Debug: Connect failed, rc 0

Error: Failed to start sendMessage, return code -3
Error: Failed to publish Event data.

20170721 055747.716 getaddrinfo failed for addr <host-addr> with rc -2
20170721 055747.716 <host addr> is not a valid IP address
20170721 055747.720 getaddrinfo failed for addr <host addr> with rc -2
20170721 055747.724 host addr> is not a valid IP address

Debug: Connect failed, rc 0

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data


20170721 055750.724 getaddrinfo failed for addr <host-addr> with rc -2
20170721 055750.724 <host addr> is not a valid IP address
20170721 055750.728 getaddrinfo failed for addr <host addr> with rc -2
20170721 055750.728 host addr> is not a valid IP address

Debug: Connect failed, rc 0

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

20170721 055753.732 getaddrinfo failed for addr <host-addr> with rc -2
20170721 055753.732 <host addr> is not a valid IP address
20170721 055753.737 getaddrinfo failed for addr <host addr> with rc -2
20170721 055753.746 host addr> is not a valid IP address

Debug: Connect failed, rc 0

libphy: 2188000.ethernet:02 - Link is Up - 1000/Full
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

20170721 055756.747 getaddrinfo failed for addr <host-addr> with rc -2
20170721 055756.747 <host addr> is not a valid IP address
20170721 055756.751 getaddrinfo failed for addr <host addr> with rc -2
20170721 055756.751 host addr> is not a valid IP address

Debug: Connect failed, rc 0

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

20170721 055800.259 SSL cipher available: 0:ECDHE-RSA-AES256-GCM-SHA384
20170721 055800.259 SSL cipher available: 1:ECDHE-ECDSA-AES256-GCM-SHA384
20170721 055800.259 SSL cipher available: 2:ECDHE-RSA-AES256-SHA384
20170721 055800.259 SSL cipher available: 3:ECDHE-ECDSA-AES256-SHA384
20170721 055800.259 SSL cipher available: 4:ECDHE-RSA-AES256-SHA
20170721 055800.259 SSL cipher available: 5:ECDHE-ECDSA-AES256-SHA
20170721 055800.259 SSL cipher available: 6:SRP-DSS-AES-256-CBC-SHA
20170721 055800.259 SSL cipher available: 7:SRP-RSA-AES-256-CBC-SHA
20170721 055800.259 SSL cipher available: 8:SRP-AES-256-CBC-SHA
20170721 055800.259 SSL cipher available: 9:DH-DSS-AES256-GCM-SHA384
20170721 055800.259 SSL cipher available: 10:DHE-DSS-AES256-GCM-SHA384
20170721 055800.259 SSL cipher available: 11:DH-RSA-AES256-GCM-SHA384
20170721 055800.263 SSL cipher available: 12:DHE-RSA-AES256-GCM-SHA384
20170721 055800.263 SSL cipher available: 13:DHE-RSA-AES256-SHA256
20170721 055800.263 SSL cipher available: 14:DHE-DSS-AES256-SHA256
20170721 055800.263 SSL cipher available: 15:DH-RSA-AES256-SHA256
20170721 055800.263 SSL cipher available: 16:DH-DSS-AES256-SHA256
20170721 055800.263 SSL cipher available: 17:DHE-RSA-AES256-SHA
20170721 055800.263 SSL cipher available: 18:DHE-DSS-AES256-SHA
20170721 055800.263 SSL cipher available: 19:DH-RSA-AES256-SHA
20170721 055800.263 SSL cipher available: 20:DH-DSS-AES256-SHA
20170721 055800.263 SSL cipher available: 21:DHE-RSA-CAMELLIA256-SHA
20170721 055800.263 SSL cipher available: 22:DHE-DSS-CAMELLIA256-SHA
20170721 055800.263 SSL cipher available: 23:DH-RSA-CAMELLIA256-SHA
20170721 055800.263 SSL cipher available: 24:DH-DSS-CAMELLIA256-SHA
20170721 055800.263 SSL cipher available: 25:ECDH-RSA-AES256-GCM-SHA384
20170721 055800.263 SSL cipher available: 26:ECDH-ECDSA-AES256-GCM-SHA384
20170721 055800.263 SSL cipher available: 27:ECDH-RSA-AES256-SHA384
20170721 055800.263 SSL cipher available: 28:ECDH-ECDSA-AES256-SHA384
20170721 055800.263 SSL cipher available: 29:ECDH-RSA-AES256-SHA
20170721 055800.263 SSL cipher available: 30:ECDH-ECDSA-AES256-SHA
20170721 055800.263 SSL cipher available: 31:AES256-GCM-SHA384
20170721 055800.263 SSL cipher available: 32:AES256-SHA256
20170721 055800.263 SSL cipher available: 33:AES256-SHA
20170721 055800.263 SSL cipher available: 34:CAMELLIA256-SHA
20170721 055800.263 SSL cipher available: 35:PSK-AES256-CBC-SHA
20170721 055800.263 SSL cipher available: 36:ECDHE-RSA-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 37:ECDHE-ECDSA-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 38:ECDHE-RSA-AES128-SHA256
20170721 055800.263 SSL cipher available: 39:ECDHE-ECDSA-AES128-SHA256
20170721 055800.263 SSL cipher available: 40:ECDHE-RSA-AES128-SHA
20170721 055800.263 SSL cipher available: 41:ECDHE-ECDSA-AES128-SHA
20170721 055800.263 SSL cipher available: 42:SRP-DSS-AES-128-CBC-SHA
20170721 055800.263 SSL cipher available: 43:SRP-RSA-AES-128-CBC-SHA
20170721 055800.263 SSL cipher available: 44:SRP-AES-128-CBC-SHA
20170721 055800.263 SSL cipher available: 45:DH-DSS-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 46:DHE-DSS-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 47:DH-RSA-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 48:DHE-RSA-AES128-GCM-SHA256
20170721 055800.263 SSL cipher available: 49:DHE-RSA-AES128-SHA256
20170721 055800.263 SSL cipher available: 50:DHE-DSS-AES128-SHA256
20170721 055800.263 SSL cipher available: 51:DH-RSA-AES128-SHA256
20170721 055800.264 SSL cipher available: 52:DH-DSS-AES128-SHA256
20170721 055800.264 SSL cipher available: 53:DHE-RSA-AES128-SHA
20170721 055800.264 SSL cipher available: 54:DHE-DSS-AES128-SHA
20170721 055800.264 SSL cipher available: 55:DH-RSA-AES128-SHA
20170721 055800.264 SSL cipher available: 56:DH-DSS-AES128-SHA
20170721 055800.264 SSL cipher available: 57:DHE-RSA-SEED-SHA
20170721 055800.264 SSL cipher available: 58:DHE-DSS-SEED-SHA
20170721 055800.264 SSL cipher available: 59:DH-RSA-SEED-SHA
20170721 055800.264 SSL cipher available: 60:DH-DSS-SEED-SHA
20170721 055800.264 SSL cipher available: 61:DHE-RSA-CAMELLIA128-SHA
20170721 055800.264 SSL cipher available: 62:DHE-DSS-CAMELLIA128-SHA
20170721 055800.264 SSL cipher available: 63:DH-RSA-CAMELLIA128-SHA
20170721 055800.264 SSL cipher available: 64:DH-DSS-CAMELLIA128-SHA
20170721 055800.264 SSL cipher available: 65:ECDH-RSA-AES128-GCM-SHA256
20170721 055800.264 SSL cipher available: 66:ECDH-ECDSA-AES128-GCM-SHA256
20170721 055800.264 SSL cipher available: 67:ECDH-RSA-AES128-SHA256
20170721 055800.264 SSL cipher available: 68:ECDH-ECDSA-AES128-SHA256
20170721 055800.264 SSL cipher available: 69:ECDH-RSA-AES128-SHA
20170721 055800.264 SSL cipher available: 70:ECDH-ECDSA-AES128-SHA
20170721 055800.264 SSL cipher available: 71:AES128-GCM-SHA256
20170721 055800.596 SSL cipher available: 72:AES128-SHA256
20170721 055800.596 SSL cipher available: 73:AES128-SHA
20170721 055800.596 SSL cipher available: 74:SEED-SHA
20170721 055800.596 SSL cipher available: 75:CAMELLIA128-SHA
20170721 055800.596 SSL cipher available: 76:IDEA-CBC-SHA
20170721 055800.596 SSL cipher available: 77:PSK-AES128-CBC-SHA
20170721 055800.596 SSL cipher available: 78:ECDHE-RSA-RC4-SHA
20170721 055800.596 SSL cipher available: 79:ECDHE-ECDSA-RC4-SHA
20170721 055800.596 SSL cipher available: 80:ECDH-RSA-RC4-SHA
20170721 055800.596 SSL cipher available: 81:ECDH-ECDSA-RC4-SHA
20170721 055800.596 SSL cipher available: 82:RC4-SHA
20170721 055800.596 SSL cipher available: 83:RC4-MD5
20170721 055800.596 SSL cipher available: 84:PSK-RC4-SHA
20170721 055800.596 SSL cipher available: 85:ECDHE-RSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 86:ECDHE-ECDSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 87:SRP-DSS-3DES-EDE-CBC-SHA
20170721 055800.596 SSL cipher available: 88:SRP-RSA-3DES-EDE-CBC-SHA
20170721 055800.596 SSL cipher available: 89:SRP-3DES-EDE-CBC-SHA
20170721 055800.596 SSL cipher available: 90:EDH-RSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 91:EDH-DSS-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 92:DH-RSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 93:DH-DSS-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 94:ECDH-RSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 95:ECDH-ECDSA-DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 96:DES-CBC3-SHA
20170721 055800.596 SSL cipher available: 97:PSK-3DES-EDE-CBC-SHA
20170721 055800.596 SSL cipher available: 98:EDH-RSA-DES-CBC-SHA
20170721 055800.596 SSL cipher available: 99:EDH-DSS-DES-CBC-SHA
20170721 055800.596 SSL cipher available: 100:DH-RSA-DES-CBC-SHA
20170721 055800.596 SSL cipher available: 101:DH-DSS-DES-CBC-SHA
20170721 055800.596 SSL cipher available: 102:DES-CBC-SHA
20170721 055800.596 SSL handshake started write:unknown:unknown
20170721 055800.596 SSL state connect:before/connect initialization:(NONE)
20170721 055800.596 sent 771 256 buflen 5
20170721 055800.596 sent 771 22 buflen 370
20170721 055800.596 SSL state connect:SSLv2/v3 write client hello A:(NONE)
20170721 055800.596 SSL connect:SSLv2/v3 read server hello A

DEREG result code : 0 :(null)

REG result code : 0 :(null)
20170721 055801.052 received 0 256 buflen 5
20170721 055801.052 received 771 22 buflen 87
20170721 055801.052 SSL state connect:unknown state:(NONE)
20170721 055801.052 received 0 256 buflen 5
20170721 055801.052 received 771 22 buflen 2087
20170721 055801.052 SSL state connect:unknown state:(NONE)
20170721 055801.052 received 0 256 buflen 5
20170721 055801.052 received 771 22 buflen 333
20170721 055801.052 SSL state connect:unknown state:(NONE)
20170721 055801.052 received 0 256 buflen 5
20170721 055801.052 received 771 22 buflen 4
20170721 055801.052 SSL state connect:unknown state:(NONE)
20170721 055801.052 sent 0 256 buflen 5
20170721 055801.052 sent 771 22 buflen 70
20170721 055801.052 SSL state connect:unknown state:(NONE)
20170721 055801.052 sent 0 256 buflen 5
20170721 055801.052 sent 771 20 buflen 1
20170721 055801.052 SSL state connect:unknown state:ECDHE-RSA-AES256-GCM-SHA384
20170721 055801.081 sent 0 256 buflen 5
20170721 055801.081 sent 771 22 buflen 16
20170721 055801.081 SSL state connect:unknown state:ECDHE-RSA-AES256-GCM-SHA384
20170721 055801.081 SSL state connect:unknown state:ECDHE-RSA-AES256-GCM-SHA384
20170721 055801.081 SSL connect:unknown state
20170721 055801.081 SSL connect:unknown state
20170721 055801.578 received 0 256 buflen 5
20170721 055801.578 received 771 20 buflen 1
20170721 055801.578 received 0 256 buflen 5
20170721 055801.578 received 771 22 buflen 16



Got the CONNACK and connection was established here.

20170721 060038.776 4 MQTT_TEST -> PINGREQ (0)
20170721 060039.212 received 0 256 buflen 5
20170721 060039.213 4 MQTT_TEST <- PINGRESP



libphy: 2188000.ethernet:02 - Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

20170721 060044.721 sent 0 256 buflen 5
20170721 060044.721 4 MQTT_TEST -> PINGREQ (0)
20170721 060050.127 PINGRESP not received in keepalive interval for client ELIKA_TEST on socket 4, disconnecting
20170721 060050.227 sent 0 256 buflen 5
20170721 060050.227 4 MQTT_TEST -> DISCONNECT (0)
20170721 060051.228 sent 0 256 buflen 5
20170721 060051.228 sent 771 21 buflen 2

20170721 060051.228 SSL alert write:warning:close notify
Debug: Connection lost
Debug: Cause: (null)
Debug: Reconnecting


socket-closed, reconnecting


Error: Failed to start sendMessage, return code -3
Error: Failed to publish Event data.
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
                                                                                                                                                                                          
Error: Failed to start sendMessage, return code -3                                           
Error: Failed while publishing Offline Activity Events Data                                  
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev- instead.

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

libphy: 2188000.ethernet:02 - Link is Up - 1000/Full
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
                                                
                                                                                       
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3      +-----------------------------+
Error: Failed while publishing Offline Activity Events D|                             |
Error: Failed to start sendMessage, return code -3      |  Cannot open /dev/ttyUSB0!  |
Error: Failed while publishing Offline Activity Events D|                             |
                                                        +-----------------------------+

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data

Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data
Error: Failed to start sendMessage, return code -3
Error: Failed while publishing Offline Activity Events Data


Back to the top