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

getaddrinfo in can block indefinitely after LTE connect

Hi,

I observed what appears to be the same issue as https://devzone.nordicsemi.com/f/nordic-q-a/51337/nrf9160-infinite-nrf_connect-blocking-behavior-post-lte-psm-wakeup/. In my use-case however, I am not using PSM and instead just switch the modem between offline (CFUN=4) and online (CFUN=1).

I'm using code copied from the mqtt_simple sample. First I switch the modem online, connect LTE, wait for the AT response indicating the connection was successful, and then I connect MQTT using the mqtt_simple code. Occasionally I will hang on the getaddrinfo call in broker_init.

I was wondering if there is any new information since the last devzone post I have linked or if there is another, safer way of initializing and connecting MQTT that won't hang.

Thanks,

Jeff

Parents
  • Hi.

    What modem fw version and NCS version are you using?

    Also, could you define "occasionally" closer?

    Does it happen at regular intervals, or at random?

    I am aware of a problem that would happen after 30 disconnects and reconnects to the network, that at least was present in older modem fw versions.

    Best regards,

    Didrik

Reply
  • Hi.

    What modem fw version and NCS version are you using?

    Also, could you define "occasionally" closer?

    Does it happen at regular intervals, or at random?

    I am aware of a problem that would happen after 30 disconnects and reconnects to the network, that at least was present in older modem fw versions.

    Best regards,

    Didrik

Children
  • Hi Didrik, I've been working with Jeff on this. This doesn't happen very often at all but it is occasionally encountered (maybe 1%). We are using NCS v1.1.0 and modem fw 1.1.0

  • How do you verify that you have connected to the cellular network?

    I had a ticket where getaddrinfo returned an error when not connected to the network: https://devzone.nordicsemi.com/f/nordic-q-a/54841/getaddrinfo-returns-error-12-with-new-modem-firmware-1-1-0-worked-with-1-0-1

    How is the signal strength where you are testing?

    If you are certain you are connected to the network, and the signal strength is good, could you take a modem trace when getaddrinfo hangs, so that we can analyze further?

  • Hi Didrik, sorry for the late reply, this fell off my radar for a while.

    It sounds like this issue is similar to the one you link above but for me it seems getaddrinfo is hanging and never returns if it's called without a cellular connection. Is there some way to add a timeout to this? What happens if the connection is lost between checking the connection and making the call to getaddrinfo?

  • Hi.

    I would recommend that you upgrade to the newest modem and NCS versions.

    I am not aware of any way to set a timeout to getaddrinfo, but it has one built in. So it shoudl time out if it is not able to contact any DNS servers, or provide another error code in other scenarios.

    Best regards,

    Didrik