This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VStartSimpleLinkSpawnTask default stack size

I've been running into an issue where the default stack size provided as part of function VStartSimpleLinkSpawnTask in osi_tirtos.c is insufficient to prevent an overflow.  The default stack is 2048 which works fine in most situations however when introducing errors I've been able to drive it up to 2704.  I've manually changed the stack size which has corrected the issue and request a parameter be added to allow an override as desired. This would allow adjusting the stack without having to copy the supplied code or code outside of the supplied routines.

The events leading to the overflow are as follows:

1)  TCP server started and waiting for input

2)  TCP client  started as another task and issues command to host.  Host has been put in a suspended state for error testing.  Note host is an external device and not the server referred to in step 1 above.

3)  TCP client receives a -11 return from the send indicating acknowledgement has not been received.

4)  TCP client then closes socket.

5)  Repeat 2-4.  The stack size of vSimpleLinkSpawnTask should first approach the initial 2048K limit.  Within 10 iterations it should exceed the limit and various faults can be encountered.

Note:  On the back end I also receive a SL_SOCKET_TX_FAILED_EVENT (Case SL_ECLOSE) out of the SimpleLinkSockEventHandler indicating a failure to transmit all the queued packets after a few seconds of completing step #3 above.

Specific order of commands in the TCP client error sequence are as follows:

sl_Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)

sl_SetSockOpt( .... ) - 3 second timeout provided

sl_Connect(....) - Connects because host is available although it is suspended.  Return 0.

sl_Send(....) - Receives a -11 return code

sl_Close(...) - Receives a return 0 on close