lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Output fails when output size exceeds 14KB while using


From: dipswitch
Subject: Re: [lwip-users] Output fails when output size exceeds 14KB while using sockets
Date: Wed, 18 Jan 2012 17:19:29 +0800 (MYT)
User-agent: SquirrelMail/1.4.9a

Oke, I found the problem! The problem was that MEM_SIZE was set at 16000
bytes and the TCP_SND_BUF was set to 32KB this leads to an wrong error
handling in tcp_write(). Because of this configuration tcp_write() thinks
there is 32KB of buffer free, so when it's trying to fragment the packet
19KB total it thinks it can write the whole packet to the output buffer.
So it starts to fragment all the packets, but when reaching the 16000
memory size limit the allocation fails, now the error handling of
tcp_write() de-allocates all fragments it created and reschedules the
packet to try and send it later. However with this configuration the
packet can never be send and it keeps retrying and retrying without
success. The task which requested the write will wait for the write to
complete but this will never happen.

Possible solutions would be to:
1. Send the fragmented packets anyway without de-allocating them and set
the TCP_WRITE_FLAG_MORE in Phase 3 tcp_write() if allocating a new pbuf
fails and number of items queued in this loop > 0
2. Add a check of if (TCP_SND_BUF >= MEM_SIZE) to lwip_sanity_check() or
create a compile error in init.c





reply via email to

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