Description
In the \mbed-os\features\net\FEATURE_IPV6\nanostack-interface, in the source file NanostackInterface.cpp. It looks like NanostackSocket::close(), closes the socket but does not free it. Every reopen (NanostackSocket::open) by calling temp_socket = socket_open(proto, 0, socket_callback), the returned socket ID (temp_socket) is incremented. So after a number of open close cycles, the returned socket ID clips on the maximum of 15, resulting in a asserting NanostackInterface.cpp function bool NanostackSocket::open(void):
if (socket_tbl[temp_socket] != NULL) {
MBED_ASSERT(false);
return false;
}
The issue is triggered when the LWM2M client cannot find a LWM2M server. See call stack:
Thread #1 1 (Thread mode) [core: 0] (Suspended : Step)
NanostackSocket::open() at NanostackInterface.cpp:205 0x8522c
NanostackInterface::socket_open() at NanostackInterface.cpp:718 0x85ce4
Socket::open() at Socket.cpp:38 0x8661e
Socket::open() at Socket.h:49 0x3d2ac
UDPSocket::UDPSocket() at UDPSocket.h:48 0x3d236
M2MConnectionHandlerPimpl::init_socket() at m2mconnectionhandlerpimpl.cpp:528 0x46b98
M2MConnectionHandlerPimpl::dns_handler() at m2mconnectionhandlerpimpl.cpp:183 0x462d6
connection_tasklet_event_handler() at m2mconnectionhandlerpimpl.cpp:63 0x45ff0
eventOS_scheduler_dispatch_event() at event.c:293 0x5f6ac
eventOS_scheduler_run() at event.c:318 0x5f6ca
event_loop_thread() at ns_event_loop.c:76 0x5d828
() at rt_CMSIS.c:827 0x8f764