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

You are right Ian client library traces are not present.I will add the prints here after recreating the issue.

Thanks

On Fri, Jul 21, 2017 at 2:52 PM, vikas sharma <vikas452@xxxxxxxxx> wrote:
Hey Ian

Both logs were taken by exporting below enviornment variables.
MQTT_C_CLIENT_TRACE_LEVEL=PROTOCOL
MQTT_C_CLIENT_TRACE=ON

Yes Connection lost callback is getting called for both the cases.But It is not trying to re-connect sometimes.

I am still trying to finalized the value of connect timeout for my case.Higher values are causing other issues to me.But that is not our concern for now.I have checked and for my case total time being taken for a successfull connection is around 2 seconds.


On Fri, Jul 21, 2017 at 2:32 PM, Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxuk> wrote:

Hello.

Both the traces show

Debug: Connection lost
Debug: Cause: (null)
Debug: Reconnecting

which implies that the connection lost callback is being invoked. If you are using automatic reconnect I wouldn't expect to see the connectFailure callback invoked (actually I think there's a bug looking at the code where I need to zero out the connect failure callback pointer once invoked once).

These traces don't tell me much. Taking client library traces by setting MQTT_C_CLIENT_TRACE=ON should give more information.

Also, your settings. A connect timeout of 3 seconds? That seems unnecessarily very low. In some circumstances, the TCP connect might take longer - you're at risk of aborting a successful connect.

Ian


On 21/07/2017 07:50, vikas sharma wrote:
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.> ÂÂÂ conn_opts.>
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



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev