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

MQTT_CONNECT fails with error -95

Hi,

Just trying to run mqtt sample with TLS and AWS IoT backend. Everything worked fine in the beginning, but then after I tweaked the code a bit I suddenly started getting error -95 during the connect.

Error -95 is not documented in NRF, but I found that it might be EOPNOTSUPP. More debugging showed that it is probably coming from modem and might be related to the certificates somehow. At the same time same certificates worked before and also I tested them using command line.

Few hours later I narrowed down the scope and basically found that absolutely any code change produces the error.

As an example below, a simple printk on line 325 basically breaks the mqtt connection. By commenting that line everything works again. This is 100% consistent.

Can it be somehow related to memory management or something?

Just in case attached my .prj file.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_LOG=y
CONFIG_LOG_STRDUP_MAX_STRING=164
CONFIG_LOG_STRDUP_BUF_COUNT=10
CONFIG_DEBUG=y
CONFIG_LOG_IMMEDIATE=y
CONFIG_TEST_RANDOM_GENERATOR=y
# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks