[En-Nut-Discussion] Race condition and stack overflow in tcpsm.c
phip at hb9etc.ch
Fri Nov 21 08:13:46 CET 2014
On 20.11.2014 22:07, Ole Reinhardt wrote:
> Hi Philipp,
> Am 14.11.2014 18:04, schrieb Philipp Burch:
>> 1. 388 for tcpsm is still too less, I managed to make it use up to 664
>> bytes and hence increased the stack space to 1024 bytes.
>> 2. The DHCP thread overflowed as well, I had to set this to 1024 bytes
>> as well.
> I made the same experience. On CM3 (lpc) I also have set the TCP and
> DHCP stack both to 1024 bytes. I never made a measurement of the really
> needed size, but I expect it will be more than 650 bytes.
Ok, I think I'll then add an extra #if defined(__CORTEX__) or something
to have it default to a higher value.
>> Always increasing the stacks doesn't seem like an appropriate solution
>> however, I'd rather like to find out why the whole thing needs so much
>> more space than on other platforms. Does anyone have an idea?
> I even doubt that 260 bytes on ARM7 are enough, but the comments in
> tcpsm.c show that the needed stack size is heavily related to the used
> compiler and optimisation. 384 bytes have been measured using the
> arm-elf compiler, while we are looking on the arm-none-eabi compilier,
> which uses a differen ABI.
> But what we learned is, that we should measure the stack sizes for the
> tcpsm with modern compilers again and then add some extra margin.
Ok, this sounds like a reasonable explanation. Looks like just about any
thread that does some considerable amount of work needs at least 1kiB of
More information about the En-Nut-Discussion