( Edit: moved from Troubleshooting to Firmware as seems more appropriate )
Hey guys - back with another hang and was wondering if anyone could run a friendly eye over it to see if they can help me in debugging this further.
We upgraded to v0.4.7 a while back to bring in a few of the fixes that were addressed. We then took a few units into the field for testing and in one situation we had bad WiFi conditions. In this situation, we saw our application hang up a lot.
Bringing it back into the office (our test location has ok WiFi), we started to see the same thing.
I started to force disconnects and reconnects on the desk while on the debugger with openOCD and managed to cause this again and capture a stack trace that indicated it was in the UDP::stop function.
(Note: Before I go further, the reason we are calling this function; we have a UDP socket multicasting sensor data once a second. A few releases ago we had some problems with it dropping out so we had our code re-build the socket every 30 seconds. This is probably too quickly and a bit of a hack but besides the point for now)
Program received signal SIGINT, Interrupt.
0x0803d5d6 in remove (this=<optimized out>, item=0x200120c0) at src/photon/socket_hal.cpp:522
522 if (current->next==item) {
(gdb) info threads
Id Target Id Frame
9 Thread 536927480 (worker thread) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
8 Thread 536928304 (worker thread) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
7 Thread 536941432 (WWD) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
6 Thread 536926192 (Tmr Svc) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
5 Thread 536935856 (std::thread) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
4 Thread 536939792 (tcpip_thread) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
3 Thread 536918768 (system monitor) 0x080258c4 in vPortYield () at WICED/RTOS/FreeRTOS/ver7.5.2/Source/portable/GCC/ARM_CM3/port.c:332
2 Thread 536925696 (IDLE) 0x08024c54 in prvIdleTask (pvParameters=<optimized out>) at WICED/RTOS/FreeRTOS/ver7.5.2/Source/tasks.c:2261
* 1 Thread 536919376 (app_thread : : Running) 0x0803d5d6 in remove (this=<optimized out>, item=0x200120c0) at src/photon/socket_hal.cpp:522
(gdb) where
#0 0x0803d5d6 in remove (this=<optimized out>, item=0x200120c0) at src/photon/socket_hal.cpp:522
#1 socket_dispose (handle=536944832) at src/photon/socket_hal.cpp:673
#2 0x0803d7be in socket_close (sock=<optimized out>) at src/photon/socket_hal.cpp:935
#3 0x0803b718 in UDP::stop (this=0x20014140) at src/spark_wiring_udp.cpp:105
#4 0x08032068 in Coap::loop (this=0x20014140) at ../../../src/Coap.cpp:198
#5 0x080354dc in NetworkController::process (this=<optimized out>) at ../../../src/NetworkController.cpp:19
#6 0x08035b52 in PublishController::process (this=<optimized out>) at ../../../src/PublishController.cpp:32
#7 0x0803a66c in loop () at ../../../src/application.cpp:165
#8 0x0803fca0 in app_loop (threaded=<optimized out>) at src/main.cpp:231
#9 0x0803f954 in ActiveObjectBase::run (this=this@entry=0x20009490 <ApplicationThread>) at src/active_object.cpp:49
#10 0x0803fd36 in start (this=0x20009490 <ApplicationThread>) at ./inc/active_object.h:389
#11 app_setup_and_loop () at src/main.cpp:297
#12 0x0803bffc in application_start () at src/stm32f2xx/core_hal_stm32f2xx.c:502
#13 0x0802c832 in application_thread_main (arg=<optimized out>) at WICED/RTOS/FreeRTOS/WICED/wiced_rtos.c:177
#14 0x00000000 in ?? ()
Looking at this, it seems to be stuck inside a while()
loop in that socket_hal.cpp
:
/**
* Removes an item from the linked list.
* @param item
* @param list
*/
bool remove(socket_t* item)
{
bool removed = false;
if (items==item) {
items = item->next;
removed = true;
}
else
{
socket_t* current = items;
while (current) {
if (current->next==item) {
current->next = item->next;
removed = true;
break;
}
}
}
return removed;
}
GDB is only reporting a few of the objects in play though…
(gdb) p current
$1 = <optimized out>
(gdb) p item
$3 = (socket_t *) 0x200120c0
(gdb) p item->next
$4 = (socket_t *) 0x1
(gdb) p items
value has been optimized out
Anyone help me any further?
I’m going to remove the socket rebuild and see if it helps but would be good to debug this further.