1) It seems that your tasks are allocating a huge stack and there is not enough memory for the server. With TAD (Task Awae Debugger) you can see the your task usage, try reducing your tasks stack size to have 90% of usage in each task.You can find information about how to use TAD in MQX Quick Start Guide located in documentation folder in MQX installation path.
2) If the problem persists you may not have enough stack for the server. When you call the function HTTPSRV_init() it uses the structure HTTPSRV_PARAM_STRUCT to be initialized, in this structure you have the "script_stack" variable which is the size of the 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. I strongly recommend to use this server which is the new MQX4.0 server.
3) If you are running out of blocks it might be possible that you need more PCBs, MSG and sockets. Could you please add the next lines just before call the function RTCS_create() just as the web_hvac does in the C:\Freescale\Freescale MQX 4.0\demo\web_hvac\RTCS.c file?
/* runtime RTCS configuration */
_RTCSPCB_init = 4;
_RTCSPCB_grow = 2;
_RTCSPCB_max = 20;
_RTCS_msgpool_init = 4;
_RTCS_msgpool_grow = 2;
_RTCS_msgpool_max = 20;
_RTCS_socket_part_init = 4;
_RTCS_socket_part_grow = 2;
_RTCS_socket_part_max = 20;
4) You can also modify your sockets bffers size. With TAD you can also check TCP socket connection memory usage.You can call setsockopt() to reduce OPT_TBSIZE and OPT_RBSIZE and the memory usage to open a new TCP socket will be reduced. E.g.
uint_32 value;
…
value = 1024;
setsockopt(sock, SOL_TCP,OPT_TBSIZE,&value,sizeof(value));
setsockopt(sock, SOL_TCP,OPT_RBSIZE,&value,sizeof(value));
5) Finally, if you dont have all MQX4.0.2 patches you may be missing some MQX fixes. Please take a look to the link below.
https://community.freescale.com/message/351405#351405
I hope this helps. Have a nice day!
Carlos