MQTT client - calling nrf_getaddrinfo couse reset

I'm using the nrf9160dk (ns). I started an application based on the SIMPLE_MQTT sample. At first, every this worked. I added my one MQTT client with a different set of buffers and structures.

The "original" MQTT client (the one that runs from main.c) is working well. When I try to create 2nd client from a different thread, (and the LTE is connected), once I get to nrf_getaddrinfo the system reboot itself.

Following is the code that eventually calls to nrf_getaddrinfo. (the same nrf_getaddrinfo  worked fine when called from main)

static int rit_broker_init(uint8_t *host, unsigned short port)
{
    int err;
    struct addrinfo *result;
    struct addrinfo *addr;
    struct addrinfo hints = {
        .ai_family = AF_INET,
        .ai_socktype = SOCK_STREAM
    };

    err = getaddrinfo(CONFIG_MQTT_BROKER_HOSTNAME, NULL, &hints, &result);
    if (err) {
        LOG_ERR("getaddrinfo failed: %d", err);
        return -ECHILD;
    }
.....
Uri.
Related