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

NRF modem 1.1.1 firmware, 1.2 SDK. Re-using sockets causes hang in nrf_connect.

I'm porting a working app from SDK 1.1 to 1.2, and have noted that when I make an mqtt connection close it, and re-open (to a different mqtt server) that the call to nrf_connect hangs indefinitely.

The socket number is the same, which makes me think that when the first connection closes, it leaves something in a bad state.

The two separate mqtt connections work fine in isolation from each other, just not when the connections are made sequentially. (open, close, open)

Also, I've noted that when I modify the code to make both connections one after the other, forcing the use of another "new" socket for the second connection, things work fine.

This worked fine with modem firmware 1.1.1 and SDK 1.1, so it seems like it might be a new SDK 1.2 bug.

Parents Reply
  • Didrik and Johan,

    I think both of you were wondering how I worked around this problem.

    Here is the procedure.

    Open MQTT Connection 1 (with TLS)

    Open MQTT Connection 2 (with TLS)

    Service connection 1 (in this case AWS FOTA)

    Close Connection 1.

    Service connection 2.

    The time require to service connection 1 is short enough that connection 2 does not time out, it's well within the mqtt poll interval.

    Didrik,

    I'll try the modem log again.

    Josh

Children
Related