lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Crash in 'stats_display_memp()'


From: Eric Koldeweij
Subject: Re: [lwip-users] Crash in 'stats_display_memp()'
Date: Sat, 7 Dec 2024 11:14:29 +0100
User-agent: Mozilla Thunderbird

Gisle,

You have definitely a problem with your "mem" pointer. There are 3 items added to the front and 3 items missing at the end. I definitely never encountered this before and I suspect that something has changed the pointer in an incorrect way or a copy gone wrong - some memory management issue. I think I cannot be of much more help here right now - it is certainly not a known issue. If you have it running on host, run with valgrind and see where it goes wrong.

The reason I asked about traffic is that without anything the stats will not count. It was to investigate if the problem occurs during initialization or after that. I would say it's after the initialization.

Good luck in finding this!

Regards,

Eric.

On 12/7/24 08:29, Gisle Vanem via lwip-users wrote:
Eric Koldeweij wrote:

Normally RAW_PCB is the first one in the list and there should not be anything before that. Do you have either LWIP_MALLOC_MEMPOOL or LWIP_PBUF_MEMPOOL defined in your code?

No.

Do you use custom pools (MEMP_USE_CUSTOM_POOLS defined to
a nonzero value)? If so, please post your lwippools.h.

No I use '-DMEMP_MEM_MALLOC=1 -DMEM_LIBC_MALLOC=1'.

The code creating the enum is in src/include/lwip/memp.h and it takes its items from src/include/lwip/priv/memp_std.h.

try using "gcc -E" to see what the include file expands like when it's processed?

Here is the relevant pre-processed output of
'clang-cl -E':

typedef enum
{
# 1 ".//src/include/lwip/priv/memp_std.h" 1
# 42 ".//src/include/lwip/priv/memp_std.h"
  MEMP_RAW_PCB,
  MEMP_UDP_PCB,
  MEMP_TCP_PCB,
  MEMP_TCP_PCB_LISTEN,
  MEMP_TCP_SEG,
  MEMP_ALTCP_PCB,
  MEMP_REASSDATA,
  MEMP_FRAG_PBUF,
  MEMP_NETBUF,
  MEMP_NETCONN,
  MEMP_TCPIP_MSG_API,
# 94 ".//src/include/lwip/priv/memp_std.h"
  MEMP_ARP_QUEUE,
  MEMP_IGMP_GROUP,
  MEMP_SYS_TIMEOUT,
  MEMP_NETDB,
  MEMP_ND6_QUEUE,
  MEMP_IP6_REASSDATA,
  MEMP_MLD6_GROUP,
# 133 ".//src/include/lwip/priv/memp_std.h"
  MEMP_PBUF,
  MEMP_PBUF_POOL,
# 55 ".//src/include/lwip/memp.h" 2
  MEMP_MAX
} memp_t;

---------

Looks OK to me; MEMP_RAW_PCB=0, but
'lwip_stats.memp[0] == NULL' even still. Even
after a lot of traffic was sent/received.

I wondered about your original statement:

Has any traffic already occurred?

Is it so that such a RAW_PCB pool is not initialised before traffic
occur? If so, the 'stats_display_memp()' fails to assume that.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]