Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

CGI stack size overflow ?

Altera_Forum
Honored Contributor II
1,008 Views

Hi all, 

 

I was wondering how to increase the stack size of a CGI program because I observed than when I tried to read more than a hundred I2C registers and print their values in a HTML page, the webserver BOA does not seem to crash (no error log and no console message) but does not respond anymore, as if the C-code never stops (looks like stack size overflow ??)... If I tried to read less than a hundred I2C registers, the CGI works perfectly and prints the results correctly !! 

 

I think about adding this simple line in the makefile located in "uClinux-dist/user/cgi-generic/" : 

 

------------------------------------------------------- 

EXEC = test.cgi 

OBJS = test.o cgivars.o htmllib.o template.o 

 

fltflags += s 16384 

 

all: $(EXEC) 

------------------------------------------------------- 

 

in order to pass stack size from 4KB (default) to 16KB for example... 

 

Is there a better solution to avoid BOA freezing situation ?? 

 

Sorry for my poor language and thanks for your help :)
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
322 Views

Why do you think Boa sees any internals of the cgi program ? AFAIK, it just starts the program and waits for it's output. Maybe the CGI program's output is too large, but here, maybe you might consider to split it in several web pages.  

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
322 Views

From the BOA server point of view, what happened if the CGI stack overflows ?? 

 

I found this article : 

 

http://articles.techrepublic.com.com/5100-10878_11-1044694.html 

 

-------------------------------------------------------------------------- 

4. The program needs to return a valid response 

Any CGI program that runs must return a valid response to the browser. However, if the program encounters a problem while running and dies, it could output an error message. If you were running the program in a normal window on NT or UNIX, you would simply see the error message. 

 

But in the Web world, the program needs to hand its response back to the Web server, which then packages it to send back to the browser. If the program outputs an error message, the Web server does not get the response it expects and instead returns a general error (501 error, for example) back to the browser, saying there was a problem running the program. 

-------------------------------------------------------------------------- 

 

If I wait a certain amount of time after the crash (certainly after a timeout defined by default), the BOA prints the 501 error but responds and does not need to be restarted !!! That's why I thought about a stack size overflow....
0 Kudos
Reply