2009-11-26 10:09:08 BOA and cgi script output
Peter Gombos (HUNGARY)
Message: 82784
Hi,
I use 2009R1RC6 on bf537. I have a problem when I running a script. It seems if the output of the script is longer than 64K the forked process hangs. BOA waits for the child process but it never ends.
If I kill the child process, BOA continues fine.
It doesn't matter I call shell script, perl script or binary program. My last try was a simple C program:
int main(int argc, char *argv[])
{
int i,j=0;
printf("Content-type: text/html\n\n");
for (i=0; i<1000; i++)
j+=printf("<div>0123456789012345678901234567890123456789012345678901234567890123456789012 Line nr: %03d</div>\n",i); //100 bytes per line
printf("Approx. %d bytes written\n",j);
return 0;
}
The scripts work fine on my Ubuntu desktop with BOA. Any idea?
QuoteReplyEditDelete
2009-11-29 16:41:48 Re: BOA and cgi script output
Mike Frysinger (UNITED STATES)
Message: 82871
mmu systems can have dynamically extended buffers where as nommu obviously cant. this can easily come up when trying to send a lot of data via pipes for example.
does adding fsync(1) make a difference ?
QuoteReplyEditDelete
2009-12-01 09:13:19 Re: BOA and cgi script output
Peter Gombos (HUNGARY)
Message: 82921
Hi Mike,
Unfortunatelly does NOT make any difference.
I tried fsync(1) and fflush(1) without any effect.
As far as I see BOA uses pipes (boa.../src/cgi.c in function init_cgi() ). Do I really need pipes? I wrote a simple inetd server and I can send big amount of data to the stdout which is redirected to a socket. This way works fine.
QuoteReplyEditDelete
2009-12-01 18:20:04 Re: BOA and cgi script output
Mike Frysinger (UNITED STATES)
Message: 82931
i didnt write boa, nor have i looked in depth at the code, so i cant say that pipes are absolutely required.
QuoteReplyEditDelete
2009-12-01 20:49:09 Re: BOA and cgi script output
Mike Frysinger (UNITED STATES)
Message: 82934
ive now gone through the changes and made some fixes in svn trunk. cgi scripts can now easily output 100k+ while servicing other requests.
see if that makes a difference in your work too.
QuoteReplyEditDelete
2009-12-02 03:34:05 Re: BOA and cgi script output
Peter Gombos (HUNGARY)
Message: 82960
Mike,
You did a great job. Using the patch I can write out several megabytes. It is more than enough. I'm very happy about it.
Thank you.