Hello,
I am currently working on an IIoT product using Zephyr and NRF SDK v1.5.1-2-g76c027893 on the NRF9160 and a WFM200 wifi chip.
For this project we are using Civetweb as a webserver serving a website of about 600KB in size.
When this website is accessed, I frequently get a number of packet allocation failures from Zephyr's network stack which can cause timeouts on the client side in some cases.
Additionally, Zephyr crashes with the following bus fault after some reloads or sometimes immediately on the first attempt.
[00:00:11.543,182] <inf> filesystem: File index.html opened [00:00:12.116,424] <err> net_pkt: Data buffer (1500) allocation failed. [00:00:12.139,312] <err> net_tcp: conn: 0x2003c980 packet allocation failed, len=1460 [00:00:12.463,684] <err> net_pkt: Data buffer (1500) allocation failed. [00:00:12.486,572] <err> net_tcp: conn: 0x2003c980 packet allocation failed, len=1460 [00:00:12.686,920] <err> os: ***** BUS FAULT ***** [00:00:12.707,855] <err> os: Precise data bus error [00:00:12.729,095] <err> os: BFAR Address: 0x4db6d [00:00:12.750,244] <err> os: r0/a1: 0x0004db6d r1/a2: 0x00000000 r2/a3: 0x00000048 [00:00:12.774,597] <err> os: r3/a4: 0x0004db6d r12/ip: 0x00000000 r14/lr: 0x00028f39 [00:00:12.798,950] <err> os: xpsr: 0x01000200 [00:00:12.819,671] <err> os: Faulting instruction address (r15/pc): 0x00048508 [00:00:12.843,200] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 [00:00:12.866,607] <err> os: Current thread: 0x200147c8 (unknown) [00:00:12.909,240] <err> os: Halting system
The information from the bus fault reveals that the crash is caused by memset which gets called by pkt_alloc in zephyr/subsys/net/ip/net_pkt.c:1196.
The problem seems to depend on the website's size. Using a smaller website (around 5KB) decreases the bus fault's frequency.
I already tried to tweak several Kconfig options listed below but nothing seems to have worked so far.
CONFIG_NET_TX_STACK_SIZE=2048 CONFIG_NET_RX_STACK_SIZE=2048 CONFIG_NET_BUF_RX_COUNT=30 CONFIG_NET_BUF_TX_COUNT=30 CONFIG_NET_BUF_DATA_SIZE=320
Thank you very much in advance for your help.
Kind regards
Nils