perhaps you don't have enough stack. When you call the function HTTPSRV_init() you give as parameter the structure HTTPSRV_PARAM_STRUCT. In this structure you have the "script_stack" variable. This variable is the size of a stack of the script handler task in bytes. Try to set the value of this variable according to the memory requirements of your CGI callbacks. The default value is 750 bytes.
perhaps you don't have enough stack. When you call the function HTTPSRV_init() you give as parameter the structure HTTPSRV_PARAM_STRUCT. In this structure you have the "script_stack" variable. This variable is the size of a stack of the script handler task in bytes. Try to set the value of this variable according to the memory requirements of your CGI callbacks. The default value is 750 bytes.
Well, the memory is finite. So, you shall use the Task Aware Debugging to see how much memory is left in the HTTP server stack. This is not a dynamic memory allocation so you need to calculate well and assign what you think it is going to be enough. A try and test method could work. It is not the best approach but at least will give a good result.