assertion failures in lwip stack

0xffff
Posts: 41
Joined: Tue Jun 19, 2018 1:53 am

assertion failures in lwip stack

Postby 0xffff » Tue Jul 03, 2018 7:01 am

Hi,

I have seen several assertion-related crashes/reboots in my logs (that does both http and mqtt), generally in low-connectivity environments that require mqtt reconnects. For example:

Code: Select all

assertion "sock->select_waiting > 0" failed: file "/dev/Firmware/esp-idf/components/lwip/api/sockets.c", line 1747, function: lwip_select
[2018-07-01T12:50:33.325] [ALL] USB - abort() was called at PC 0x40115377 on core 0
Looking at the code in socket.c:

Code: Select all

        sock = tryget_socket(i);
        if (sock != NULL) {
          sock->select_waiting++;
          LWIP_ASSERT("sock->select_waiting > 0", sock->select_waiting > 0);
        } else {
seems that sock->select_waiting would have to have been < 0 entering the code. Under what conditions can that happen?

I have also seen:

Code: Select all

[2018-07-01T11:00:43.459] [ALL] USB - assertion "conn->state == NETCONN_CONNECT" failed: file "/dev/Firmware/esp-idf/components/lwip/api/api_msg.c", line 1185, function: lwip_netconn_do_connected
[2018-07-01T11:00:43.481] [ALL] USB - abort() was called at PC 0x40115377 on core 0
This one seems to happen if the connected callback is called but the state is not in a connected state. How would I debug why that would happen?

Thanks!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: assertion failures in lwip stack

Postby ESP_Angus » Tue Jul 03, 2018 11:47 pm

0xffff wrote: seems that sock->select_waiting would have to have been < 0 entering the code. Under what conditions can that happen?
I don't think this is possible without memory corruption. ie if some other code is overflowing a buffer and overwriting the socket with garbage data.

You can try some of the steps shown here to see if corruption is detected:
https://docs.espressif.com/projects/esp ... -detection

Who is online

Users browsing this forum: No registered users and 105 guests