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

Getting ERROR: getaddrinfo failed -11 in MQTT connection

Hi Dev team,

I have been working with the MQTT example and building up my application. I establish a successful connection with the broker and everything runs fine for 5-6 days. Then I get the (ERROR: getaddrinfo failed -11 ) error and the MQTT connection does not happen. I looked into the code and found that this error is because the broker's address is not obtained. 

I looked into the errno and found that -11 refers to "No more processes". 

I could not understand why this error comes up suddenly and how could I solve this issue.

Its strange because it comes up after things have been running smoothly. 

Regards,

Adeel.

Parents Reply
  • Hi Oyvind,

    It would be hard to provide it now as I had to make the device working again. The issue does not have a periodic trend so to say. I have observed it happen after every 6-7 days of deployment, and I have observed it happen twice. 

    The error occurs when I try to connect to MQTT and it goes into the broker_init() function in mqtt library. 

      err = getaddrinfo(hostname, NULL, &hints, &result);
      if (err) {
        printk("ERROR: getaddrinfo failed %d\n", err);
    
        return;
      }

    Normally it directly fetches the IP and MQTT connects, but when this errors occurs- I believe its unable to fetch the IP or so. Issue is when this error occurs, it never resolves itself later on till I reset it. I was hoping for a clean workaround for this (right now I do a soft reboot when I get this).

    Regards,

    Adeel.

Children
Related