You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by BAO RuiXian <ba...@atbusiness.com> on 2002/01/18 14:43:39 UTC

send body timed out

Hello, gurus,

    I have a Perl application running on apache server on a unix box. My
application executes 12 SQL sentences and brings the result to screen
after each SQL sentence finished (yes, I do set up the output flush
variable $| to 1.). Most of my SQL sentences spend 5 - 10 minutes in the
solid database, but there is one big one, which takes about 30 minutes
to execute. When I tried to run the application via Netscape, the
application stopped just before completion of execution of the biggest
SQL sentence. I know this from the output the application gave on the
screen. After I checked the apache's log file, I found a 'send body
timed out' error. Does this mean that I should increase the value of
Timeout in the httpd.conf file. The current value is 300 seconds before
receives and sends time out. If this is the case, I think I need to set
the value as 2 hours, i.e. 7200 seconds. Is this value too high? I
failed to find any maximum value for the FAQ of apache and the web.

Your help is appreciated.

Best

--
BAO RuiXian, PROGRAMMER, Technologies Team, Project Services Group
AtBusiness Communications Oyj, Kaapeliaukio 1,  FIN-00180 Helsinki
tel. +358-9-2311 6674, mob. +358-50-329 6275, fax +358-9-2311 6601
http://www.atbusiness.com, email: bao.ruixian@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Load Balanced, clustered, no error logs.

Posted by Joshua Slive <jo...@slive.ca>.
> From: justken [mailto:justken@rogers.com]
>
> If someone could let me know specifically if logging errors to a
> directory
> using the vhost container on a load balanced and is in some way limited,
> buggy, or disabled. and or a work around, i would be greatly indebted.

There is nothing in apached which prevents having a separate error log for
each virtual host.  A few things to consider:

1. It sounds like a rather complicated setup.  I have no idea exactly what
your ISP is doing, so it is impossible to tell if there is some non-apache
related restrction.

2. Log files should not be placed in non-root writable directories because
of serious security issues.

3. Sites with a very large number of vhosts sometimes need to log to a
single file because they do not have enough file descriptors available to
log separately.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Load Balanced, clustered, no error logs.

Posted by justken <ju...@rogers.com>.
our host is using load balancing on a clustered server system, they are 
using BSD and NT with some sort of OS cross bridge.

we have learned from the senior technical advisor that the errors can only 
be directed to a single error_log. I have sent him my httpd.conf  file 
where my error logs are routed to a log directory in each vhost container, 
but am not sure this will work on a system of that nature, as i am not 
nearly in a position to understand what is happening over a clustered 
setup, but would assume that each server instance would have the same 
httpd.conf file, and that external routers would be responsible for 
splitting the load across each server. the log files are then mirrored 
across the rest of the system as time progresses - am i correct in thinking 
this?

If someone could let me know specifically if logging errors to a directory 
using the vhost container on a load balanced and is in some way limited, 
buggy, or disabled. and or a work around, i would be greatly indebted.

If this is contained in the manuals, please direct me there, as i have not 
gotten much past single server hosting for my own purposes. and don't 
really know where to start looking, and this is fairly important to me. I 
have searched for information on clustering and apache, however it seems 
that nothing is explained about the ramifications of clustering, except 
sharing issues.

thanks



ken easson
justken.net
justken@rogers.com
justken web programming and technical support.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: send body timed out

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello, Joshua,

Strange that I also got my previous mail from the list just couple of days ago.
Anyway.

>
> My example was sh (bourne shell) syntax.  It needs to be adapted for
> whatever language you use, but the basic idea (put it in the background and
>

Thanks. How come I forgot the syntax is not for Perl.

> close stdin, stdout, and stderr) should be relatively easy to implement in
> any language.
>

To be honest, I did not close the stdin, stdout and stderr descriptors, although
I should. I did not do it because my child block only contains one line, i.e.
$sth->execute().

>
> You seem to be trying to fork a bunch of different background jobs.  This is
> not necessary.  You simply need to fork one long-lived process, close its
> file descriptors, and have it do all the processing you want.
>

Yes, indeed. The long processes are inside a module, somehow far-away from the
main program where the loop block locates. If include the loop inside the child,
the child block will be long and printing of the status for each statement
execution will also need to be done inside the child. I am afraid of the longer
the child is, the more problem it might cause.

>
> I would suggest, if you need further detailed help, that you go to a forum
> specific to the language you are using (perl?) or to one of the cgi forums.
>

That is true, thanks. Actually, I have already looked some newsgroups, although
it is often like that a right solution needs good experiences from various
aspects of web application, such as CGI, database, programming languages etc.

Best

Bao

--
BAO RuiXian,  PROGRAMMER, Technologies Team, Project Services Group
AtBusiness Communications Corp., Kaapeliaukio 1, FIN-00180 Helsinki
tel. +358-9-2311 6674, mob. +358-50-329 6275,  fax +358-9-2311 6601
http://www.atbusiness.com, email: bao.ruixian@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: send body timed out

Posted by Joshua Slive <jo...@slive.ca>.
> From: BAO RuiXian [mailto:bao.ruixian@atbusiness.com]

>
> Hello, Joshua,
>
> >
> > "long_process" means the stuff that you want to keep going
> after the main
> > page has been delivered to the client.  This is the stuff that
> is doing your
> > long calcualtions.  If you don't put it in background and close the file
> > descriptors, it will get killed when the client finishes
> getting the rest of
> > the page.
>
> Actually, my program has many 'long processes'. There is a loop
> in the program,
> and each loop will try to execute one SQL sentence. Before
> finishing execution
> of each sentence, I don't want to process futher, for I want to
> get the result
> to the page (now of course to a separate file.). Obviously, the
> strategy in the
> following is not quite suiting my needs. I have read quite some
> disccution from
> some related newsgroups (that is also why I response to your
> message a little
> bit later), and have got some ideas.


>
> Actually, before your this message, I tried the following command
>
>     $sth->execute()< /dev/null > /dev/null 2>&1 &
>
> And not working, giving syntax error, then I tried to use double
> quotes to quote
> them, and eval to include them, but nothing happended in the database.
>
> Thank you very much for your great help and will let you know if
> I have further
> problem.
>

My example was sh (bourne shell) syntax.  It needs to be adapted for
whatever language you use, but the basic idea (put it in the background and
close stdin, stdout, and stderr) should be relatively easy to implement in
any language.

You seem to be trying to fork a bunch of different background jobs.  This is
not necessary.  You simply need to fork one long-lived process, close its
file descriptors, and have it do all the processing you want.

I would suggest, if you need further detailed help, that you go to a forum
specific to the language you are using (perl?) or to one of the cgi forums.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: send body timed out

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello, Joshua,

>
> "long_process" means the stuff that you want to keep going after the main
> page has been delivered to the client.  This is the stuff that is doing your
> long calcualtions.  If you don't put it in background and close the file
> descriptors, it will get killed when the client finishes getting the rest of
> the page.

Actually, my program has many 'long processes'. There is a loop in the program,
and each loop will try to execute one SQL sentence. Before finishing execution
of each sentence, I don't want to process futher, for I want to get the result
to the page (now of course to a separate file.). Obviously, the strategy in the
following is not quite suiting my needs. I have read quite some disccution from
some related newsgroups (that is also why I response to your message a little
bit later), and have got some ideas.

Basically, I fork a child process each time in a loop for excuting the current
SQL sentence, like $sth->execute(), and let the parent process to wait for the
child process to finish before further going down. This runs pretty well, I
don't use exit(0) command at the end of each child process though (Don't know if
this is a problem or not later). I did one test, and it took about 24 hours to
get the whole thing done with being destroyed, even there appeared some other
processes in the middle of execution like the backup process of the database
itself at night, etc.

> long_process < /dev/null > /dev/null 2>&1 &

Actually, before your this message, I tried the following command

    $sth->execute()< /dev/null > /dev/null 2>&1 &

And not working, giving syntax error, then I tried to use double quotes to quote
them, and eval to include them, but nothing happended in the database.

Thank you very much for your great help and will let you know if I have further
problem.

Best

--
BAO RuiXian, PROGRAMMER, Technologies Team,  Project Services Group
AtBusiness Communications Corp., Kaapeliaukio 1, FIN-00210 Helsinki
tel. +358-9-2311 6674, mob. +358-50-329 6275,  fax +358-9-2311 6601
http://www.atbusiness.com, email: bao.ruixian@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: send body timed out

Posted by Joshua Slive <jo...@slive.ca>.
> From: BAO RuiXian [mailto:bao.ruixian@atbusiness.com]

>
> > I can't help you with your javascript, but to create long lived
> processes
> > from CGIs, you need to put them in the background and close all file
> > descriptors.  An example from the CGI FAQ:
> >         "long_process < /dev/null > /dev/null 2>&1 &"
> >         print HTML page as usual
>
> Hello, Joshua, I don't quite understand the CGI's 'long_process'
> here. I think
> my CGI's processes are quite short. For example, the redirect
> command is really
> not a long process. The other processes are just ordinary Perl modules's
> subroutines/opterations, which I am not sure if they are 'CGI'
> processes are
> not. I tried to put the redirect in the background, it wont return to the
> refresh page -- obviously, although I can see the whole program is still
> running in the Solid database. When I tried to put other Perl's
> subroutine in
> the background, nothing happened -- I think the program just stopped there
> before going into the background.

"long_process" means the stuff that you want to keep going after the main
page has been delivered to the client.  This is the stuff that is doing your
long calcualtions.  If you don't put it in background and close the file
descriptors, it will get killed when the client finishes getting the rest of
the page.

You seem to be pretty confused here.  Let's try it in the simplest possible
way, and then you can build complication once you get this to work.

I'm assuming you have an ordinary (non cgi) program called "long_process"
that does a bunch of work (requiring 30 minutes or more) and then outputs
the result into the file /long_process_results.txt (in the document root).
Then you could write a CGI script that looks like this:

#!/bin/sh
echo "Content-Type: text/html"
echo
long_process < /dev/null > /dev/null 2>&1 &
echo "<html><body><p>This program takes a while to run.  When it finishes,
the"
echo "output will be <a
href="/long_process_results.txt">here</a>.</p></body></html>"

See if you can get that to work.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: send body timed out

Posted by BAO RuiXian <ba...@atbusiness.com>.
> I can't help you with your javascript, but to create long lived processes
> from CGIs, you need to put them in the background and close all file
> descriptors.  An example from the CGI FAQ:
>         "long_process < /dev/null > /dev/null 2>&1 &"
>         print HTML page as usual

Hello, Joshua, I don't quite understand the CGI's 'long_process' here. I think
my CGI's processes are quite short. For example, the redirect command is really
not a long process. The other processes are just ordinary Perl modules's
subroutines/opterations, which I am not sure if they are 'CGI' processes are
not. I tried to put the redirect in the background, it wont return to the
refresh page -- obviously, although I can see the whole program is still
running in the Solid database. When I tried to put other Perl's subroutine in
the background, nothing happened -- I think the program just stopped there
before going into the background.

Best
--
BAO RuiXian,  PROGRAMMER, Technologies Team, Project Services Group
AtBusiness Communications Corp., Kaapeliaukio 1, FIN-00180 Helsinki
tel. +358-9-2311 6674, mob. +358-50-329 6275, fax +358-9-2311 6601
http://www.atbusiness.com, email: bao.ruixian@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: send body timed out

Posted by Joshua Slive <jo...@slive.ca>.
> From: BAO RuiXian [mailto:bao.ruixian@atbusiness.com]

> I tried to write the result to a separate file and refresh the
> file first by a
> CGI redirect command and then the file will be refreshed automatically by
> javascripts. But, now the process even stops much earlier. I
> checked system log
> file, I found the following line:
>
>     [Mon Jan 21 18:49:28 2002] [info] [client 194.100.137.2]
> (32)Broken pipe:
> client stopped connection before send body completed
>
> This is a different error from the previous "send body timed
> out". Is the new
> error because of my unproper using CGI redirect?

I can't help you with your javascript, but to create long lived processes
from CGIs, you need to put them in the background and close all file
descriptors.  An example from the CGI FAQ:
        "long_process < /dev/null > /dev/null 2>&1 &"
        print HTML page as usual

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: send body timed out

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello, Joshua,

    Thank you for your insight suggestion.

Joshua Slive wrote:

> I'm not really an expert with long-lived requests, but my guess is that you
> are running into client timeouts as much as server timeouts.  You may be
> able to fool the client by leaking out some data over time, but I think you
> will be better off if you change your strategy: write the results to a
> separate file and either refresh to the file or provide a link to it.
>

I tried to write the result to a separate file and refresh the file first by a
CGI redirect command and then the file will be refreshed automatically by
javascripts. But, now the process even stops much earlier. I checked system log
file, I found the following line:

    [Mon Jan 21 18:49:28 2002] [info] [client 194.100.137.2] (32)Broken pipe:
client stopped connection before send body completed

This is a different error from the previous "send body timed out". Is the new
error because of my unproper using CGI redirect?

BTW, the javascripts for refresh seem not working correctly either. It seems
refresh when screen blinks, but the contents are always same. I can only see
the updates by manually click the reload button on the NS browser. Anything
wrong with the following javascripts which I got from the network:

my $JSCRIPT=<<END;
  function changeLoad() {
    setTimeout("refresh()", 10*1000); //set timeout before refreshing,
                                      //in this case 10 seconds.
  }

  function refresh() {
    window.location.href = "$url" + "result/result.html";
  }

END

Anyway, it seems works fine from the command line.

Best

--
BAO RuiXian,  PROGRAMMER, Technologies Team, Project Services Group
AtBusiness Communications Corp., Kaapeliaukio 1, FIN-00180 Helsinki
tel. +358-9-2311 6674, mob. +358-50-329 6275, fax +358-9-2311 6601
http://www.atbusiness.com, email: bao.ruixian@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: send body timed out

Posted by Joshua Slive <jo...@slive.ca>.
> From: BAO RuiXian [mailto:bao.ruixian@atbusiness.com]

> Most of my SQL sentences spend 5 - 10 minutes in the
> solid database, but there is one big one, which takes about 30 minutes
> to execute.

I'm not really an expert with long-lived requests, but my guess is that you
are running into client timeouts as much as server timeouts.  You may be
able to fool the client by leaking out some data over time, but I think you
will be better off if you change your strategy: write the results to a
separate file and either refresh to the file or provide a link to it.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org