Sun 04 May 2008 11:22:52 PM UTC, comment #4:
Also, if you remove the sys_timeout in tapif, you can remove the arp_timer function in tapif too.
While we're at it, the etharp_init() is unnecessary too (it is called in lwip_init()).
I tested removing the calls to sys_timeout() and etharp_init() and removing the arp_timer() function (all in tapif.c) and these all seem to cause no problems for the shell, echo, and webserver tests.
-rishi
|
Sun 04 May 2008 11:04:02 PM UTC, comment #3:
I am using 1.3.0:
1) You would think so. However, if I add the following at line 323 of memp.c:
printf("type=%d,used=%d,max=%d,avail=%d\n",type,lwip_stats.memp[type].used,lwip_stats.memp[type].max,lwip_stats.memp[type].avail);
printf("systimeouts=%d, needed =%d\n", MEMP_NUM_SYS_TIMEOUT, LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT);
I get this (using the proper greps):
systimeouts=10, needed =3
and before a telnet to port 23:
type=11,used=3,max=3,avail=10
and after:
type=11,used=4,max=4,avail=10
(note, this already includes my increase from 3 to 10) ... I was incorrect in my original bug post .. it was 3, not 2.
After trapping in memp.c and looking where the calls are made from here are the results:
tcpip.c:239 (tcpip_thread if IP_REASSEMBLY)
tcpip.c:242 (tcp_timer_needed if LWIP_ARP)
tapif.c:353 (tapif_init .. for an arp_timer)
tcpip.c:106 (tcp_timer_needed if LWIP_TCP)
So my guess is that the tapif.c timeout is the problem. It seems that the arp_timer is superflous because tcpip.c:242 makes the same call. If you remove this tapif sys_timeout, the program seems to work fine.
In fact, it would seem that the program shouldn't even compile (because of the naming conflict) except for the saving grace of the 'static' function declaration.
So, I offer a better fix: Remove the sys_timeout in tapif.c on line 352.
2) The bug is that the variables that the printf points to are NULL. One easy fix is to make this "" instead of NULL. However, it would probably be better to rewrite this as a stat_display() call.
|
Sun 04 May 2008 07:58:27 PM UTC, comment #2:
Rishi,
In init.c, there is this sanity check:
/* There must be sufficient timeouts, taking into account requirements of the subsystems. */
#if ((NO_SYS==0) && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)))
#error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts"
#endif
Isn't it enought for the first point?
For the second point, I don't have values, but a U16_F for stats format. Which lwIP release do you use ?
|
Sat 19 Apr 2008 07:29:44 PM UTC, original submission:
1) The number of SYS_TIMEOUT memblocks is too small. It is set to 2 and when I compile this on ubuntu linux, the program segfaults on the assertion "sys_timeout: timeout != NULL". What is actually happening if you turn on the memory debug is that the SYS_TIMEOUT pool is running out. However, when I increase this number and display the stats later, only 3 are used at the max. I'm not sure the problem, but increasing MEMP_NUM_SYS_TIMEOUT beyond 3 fixes it.
2) In apps/shell.c, there is a null pointer exception because at line 311, the values are set to NULL. I'm not sure the proper behavior, but if you just remove these and resize STATS_NUM and edit stat_msgs accordingly, all is well. Alternatively, the whole thing could be rewritten to use stat_display().
|