This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Civetweb crashes on NRF91 when larger website is requested.

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

Parents
  • Hi!

    For the packet allocation, try adjusting the following configs:

    CONFIG_NET_BUF_RX_COUNT
    CONFIG_NET_BUF_TX_COUNT
    CONFIG_NET_PKT_RX_COUNT
    CONFIG_NET_PKT_TX_COUNT

    As for the bus fault, the instruction that crashes doesn't make much sense - the pkt_alloc shall only proceed with the memory got allocated correctly. The actual crash might be just a result of some memory corruption caused by a different module, but it's hard to tell without a debugger.

    We'll need some more information about your setup since the actual crash seems to be related to the WiFi interface you're using. What driver are you using?

    We don't have any native WiFi drivers in the tree, they're all offloaded for now, and offloaded sockets don't use net_pkt.

    Best regards,

    Heidi

Reply
  • Hi!

    For the packet allocation, try adjusting the following configs:

    CONFIG_NET_BUF_RX_COUNT
    CONFIG_NET_BUF_TX_COUNT
    CONFIG_NET_PKT_RX_COUNT
    CONFIG_NET_PKT_TX_COUNT

    As for the bus fault, the instruction that crashes doesn't make much sense - the pkt_alloc shall only proceed with the memory got allocated correctly. The actual crash might be just a result of some memory corruption caused by a different module, but it's hard to tell without a debugger.

    We'll need some more information about your setup since the actual crash seems to be related to the WiFi interface you're using. What driver are you using?

    We don't have any native WiFi drivers in the tree, they're all offloaded for now, and offloaded sockets don't use net_pkt.

    Best regards,

    Heidi

Children
No Data
Related