Restart advertising fails with -ENOMEM

We have thousands of devices live in production and we sometimes encounter the situation that we cannot restart bluetooth advertising anymore after a connection attempt.

bt_le_adv_start will then return -12 (-ENOMEM). The only way to get out of this situation is a software reset of the device. This is done automatically now, so customer impact is limited. However we would really like to know why this is happening sometimes. 

We use the ble peripheral role and we allow only one connection (CONFIG_BT_MAX_CONN=1). bt_le_adv_start is called in a separate thread, so not in the connection callbacks.

The firmware is based on nRF Connect 3.1.1

Please find relevant code below:
BT_CONN_CB_DEFINE(conn_callbacks) = {
    .connected          = ble_connected,
    .disconnected       = ble_disconnected,
    .recycled           = ble_recycled};
    
static void ble_connected(bt_conn *conn, uint8_t err)
{
    if(current_connection != nullptr) {
        LOG_WRN("Already connected, unref old connection");
        bt_conn_unref(current_connection);
    }

    if(err != 0) {
        LOG_WRN("Connection failed (err %d), restart advertising", err);
        restart_advertising();
        return;
    }

    current_connection = bt_conn_ref(conn);
}

static void ble_disconnected(bt_conn *conn, uint8_t reason)
{
    if(current_connection != nullptr) {
        bt_conn_unref(current_connection);
        current_connection = nullptr;
    }
}

static void ble_recycled()
{
    LOG_INF("BLE recycled, restart advertising");

    restart_advertising();
}    


Any suggestions to fix this issue for real so we can remove the workaround?
Related