Thu 30 Jul 2009 01:14:34 AM UTC, original submission:
Hi, I use the lwip stack ported to avr32 uc. I run the BasicWeb example for FreeRtos, and always hang at 100 hits. In the debug log I see that never free a pbuffer of the netconn_write. I use the CVS version 1.3.2.rc with MEM_LIBC_MALLOC = 1, MEMP_MEM_MALLOC = 1, and MEM_ALIGNMENT = 4.
The log:
pbuf_alloc(length=479)
-> Get from webrowser
pbuf_alloc: allocated pbuf
pbuf_alloc(length=479) == 36872
update_arp_entry()
pbuf_alloc(length=44)
-> buffer of the ok answer.
pbuf_alloc(length=44) == 51504
pbuf_alloc(length=248)
-> buffer of hit counter
pbuf_alloc(length=248) == 51624
pbuf_alloc(length=292)
-> buffer of task list.
pbuf_alloc(length=292) == 51952
pbuf_free(36872)
-> free reception buffer.
pbuf_alloc(length=0)
-> close
pbuf_alloc(length=0) == 36872
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 52320
update_arp_entry()
pbuf_free(51504)
-> free first write
pbuf_free(51624)
-> free second write
pbuf_free(52320)
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 51504
update_arp_entry()
pbuf_free(36872)
pbuf_free(51504)
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 36872
update_arp_entry()
pbuf_alloc(length=20)
pbuf_alloc(length=20) == 51176
pbuf_free(51176)
pbuf_free(36872)
pbuf_alloc(length=62)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=62) == 36896
update_arp_entry()
pbuf_alloc(length=4)
pbuf_alloc(length=4) == 51352
pbuf_free(36896)
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 36896
update_arp_entry()
pbuf_free(51352)
pbuf_free(36896)
pbuf_alloc(length=479)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=479) == 36896
update_arp_entry()
pbuf_alloc(length=44)
pbuf_alloc(length=44) == 51680
pbuf_alloc(length=248)
pbuf_alloc(length=248) == 51800
pbuf_alloc(length=292)
pbuf_alloc(length=292) == 52128
pbuf_free(36896)
pbuf_alloc(length=0)
pbuf_alloc(length=0) == 36896
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 52496
update_arp_entry()
pbuf_free(51680)
pbuf_free(51800)
pbuf_free(52496)
pbuf_alloc(length=60)
pbuf_alloc: allocated pbuf
pbuf_alloc(length=60) == 51680
update_arp_entry()
pbuf_free(36896)
pbuf_free(51680)
The third write buffer never free.
/*! brief parse the incoming request
- parse the HTML request and send file
*
- param pxNetCon Input. The netconn to use to send and receive data.
*
*/
static void prvweb_ParseHTMLRequest( struct netconn *pxNetCon )
{
struct netbuf *pxRxBuffer;
portCHAR *pcRxString;
unsigned portSHORT usLength;
static unsigned portLONG ulPageHits = 0;
u16_t len;
/* We expect to immediately get data. */
pxRxBuffer = netconn_recv( pxNetCon );
if( pxRxBuffer != NULL )
{
/* Where is the data? */
netbuf_data( pxRxBuffer, ( void * ) &pcRxString, &usLength );
/* Is this a GET? We don't handle anything else. */
if(( NULL != pcRxString )
&& ( !strncmp( pcRxString, "GET", 3 ) ))
{
/* Update the hit count. */
ulPageHits++;
sprintf( cPageHits, "%d", (int)ulPageHits );
len = strlen( webHTTP_OK );
/* Write out the HTTP OK header. */
netconn_write( pxNetCon, webHTTP_OK, (u16_t) len, NETCONN_COPY );
/* Generate the dynamic page... First the page header. */
strcpy( cDynamicPage, webHTML_START );
/* ... Then the hit count... */
strcat( cDynamicPage, cPageHits );
strcat( cDynamicPage, "<p><pre>Task State Priority Stack #<br>************************************************<br>" );
len = strlen( cDynamicPage );
netconn_write( pxNetCon, cDynamicPage, len, NETCONN_COPY );
/* ... Then the list of tasks and their status... */
//vTaskList( ( signed portCHAR * ) cDynamicPage + strlen( cDynamicPage ) );
vTaskList( ( signed portCHAR * ) cDynamicPage );
/* ... Finally the page footer. */
strcat( cDynamicPage, webHTML_END );
len = strlen( cDynamicPage );
/* Write out the dynamically generated page. */
netconn_write( pxNetCon, cDynamicPage, len, NETCONN_COPY );
}
netbuf_delete( pxRxBuffer );
}
netconn_close( pxNetCon );
netconn_delete( pxNetCon );
}
|