This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT Socket error after 4 consecutive MQTT connect/disconnect

Hi,

we are using MQTT to push the sensor and GPS data with 1 hour interval. After 4 consecutive connect and disconnect, MQTT is returning socket error. It requires the device reboot to connect again, so rebooting the device after every 4 MQTT connections. Because of reboot the device is taking longer time to get GPS fix for first time.

It is 100% reproducible. we are using our own MQTT broker and also tried the other brokers as well and behavior is same.

Error log returned by MQTT is "ERROR: mqtt_connect -12".

Please help us to resolve the issue.

Parents
  • Hi.

    I'll need a bit more information in order to help you:

    1. What version (tag/commit of the nrf repo) are you using, and what version of the modem firmware?

    2. What kind of MQTT broker are you connecting to? AWS? Some other cloud solution? Something else?

    3. Are you certain that you are connected to the network, and that you have re-initialized the MQTT client properly when you fail to reconnect?

    4. Is it always the third time you connect to the MQTT broker that fails?

    Best regards,

    Didrik

Reply
  • Hi.

    I'll need a bit more information in order to help you:

    1. What version (tag/commit of the nrf repo) are you using, and what version of the modem firmware?

    2. What kind of MQTT broker are you connecting to? AWS? Some other cloud solution? Something else?

    3. Are you certain that you are connected to the network, and that you have re-initialized the MQTT client properly when you fail to reconnect?

    4. Is it always the third time you connect to the MQTT broker that fails?

    Best regards,

    Didrik

Children
  • Hi,

    please find my answers.

    1. What version (tag/commit of the nrf repo) are you using, and what version of the modem firmware?

    -Tested in Tag:V1.0 and V1.1.0(currently using), issue is consistent in both.

    -Modem firmware latest 1.1.0

    2. What kind of MQTT broker are you connecting to? AWS? Some other cloud solution? Something else?

    -Tested with our AWS broker and also ellipse mosquito broker, issue is consistently reproducible.

    3. Are you certain that you are connected to the network, and that you have re-initialized the MQTT client properly when you fail to reconnect?

    -Yes, tested using CEREG command and it says connected.

    Application disconnects the MQTT properly and 4th time connect is retuning error.

    4. Is it always the third time you connect to the MQTT broker that fails?

    - yes always gets error  on 4th connect.

    If required i can share you the modified simple mqtt application to reproduce the issue on your side.

  • Balamurugan said:
    If required i can share you the modified simple mqtt application to reproduce the issue on your side.

     Yes please, that would be very helpful.

  • Hi,

    I have attached the modified sample MQTT application to reproduce the issue, UART Log and mqtt settings.

    we are using IPV6 and NB NW.

    Please help us to resolve the issue.

  • Thanks.

    To connect to the local network, I am using LTE-M and IPv4 instead of NB-IoT and IPv6.

    However, I still see similar results, except that I can connect 5 times before failing on the 6th.

    I'll investigate more and keep you updated.

    Best regards,

    Didrik

  • Hi.

    I have reported this problem internally and requested help from our developers.

    I'll keep you updated about any progress.

    Best regards,

    Didrik