gcoap/esp8266: Stack overflow with gcoap example #13606
Labels
Area: CoAP
Area: Constrained Application Protocol implementations
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
The gcoap example app experiences a stack overflow when running on board esp8266-esp-12x. This issue arose due to stack use from #13386, which rebased gcoap's use of the sock library on the sock_async feature. For the lwIP stack, also depends on #13427 which added sock_async for lwIP.
Steps to reproduce the issue
There is a problem with stack use both with the GNRC networking stack and with the lwIP sock stack. However, the issue manifests itself differently for each stack. The problem is more acute with the lwIP stack.
To reproduce, build the gcoap example with DEVELHELP=0. Send a request to a server. Then accept a request from a client.
Expected results
Should be able to repeatedly send/receive messages.
Actual results
For GNRC, works as expected. However, the
ps
command (with DEVELHELP=1) shows the stack overflow. Notice that after send/receive, stack use is 1108 bytes out of 1108 available. If you rebuild withGCOAP_STACK_SIZE
set for example to 2048, stack use is 1152 bytes.For lwIP, the app receives and displays the response from the server. After receiving the request from the client, the board displays something like:
The board then will reboot after about 30 seconds.
Versions
For GNRC, use RIOT master. For lwIP, use gcoap/lwip_async_support branch, which includes #13427 for lwip sock_async.
Detailed Measurements
The table below shows stack use after sending a
/time
request to libcoap example and receiving a/riot/board
request."samr21" is for
samr21-xpro
board. "esp8266" is foresp8266-esp-12x
board.On samr21-xpro and esp8266-esp-12x, GCOAP_STACK_SIZE is 1108: 1024 from THREAD_STACKSIZE DEFAULT + 84 from sizeof(coap_pkt_t). We increased GCOAP_STACK_SIZE to 2048 for the esp8266 builds.
Using RIOT master 6dd69e7, 2019-02-29, which includes the gcoap adaptation to sock_async in #13386. esp8266 lwIP values using gcoap/lwip_async_support branch, based on RIOT master 2cc3d38, 2020-03-08, which includes #13427.
ethos
6lo
GNRC
lwIP
(1) Stack use is 1156 bytes after sending the GET to libcoap, and then increases to 1648 after receiving the GET from libcoap.
The text was updated successfully, but these errors were encountered: