Hallo Simon,

The corruptions seems to come from the shutdown function. I tracked this
down with the MEMP_SANITY_CHECK.

I only got problems with the LWIP Stack when using the webserver. I've got
other Applications which use TCPIP heavily didn't cause any problem (like
JPEG/MJPEG streamer where I forgot to use shutdown)

I've got following sequence in the webserver implementation:
if (sp->sock >= 0) {
    ioctlsocket(sp->sock, FIONBIO, (void*)0);        //removed for test
    if (shutdown(sp->sock, 1) >= 0) {                //removed for test 
        recv(sp->sock, buf, sizeof(buf), 0);         //removed for test
    }
    close(sp->sock);
}

I removed for test purposes the shutdown and the LWIP stack runs for hours
with the same test cases that led to crashes.
It is not every shutdown crashing. It is sporadic.

The call stack before the Assertion from MEMP_SANITY_CHECK is as follows:
- tcpip_thread
- lwip_netconn_do_delconn
- lwip_netconn_do close_internal
- tcp_close
- tcp_close_shutdown
- memp_free
- do_memp_free_pool -> ASSERT

In tcp_close_shutdown the pcb->state is already CLOSED

But not using shutdown is not really a solution for me.

Best regards,
Sandra



_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to