Bug 46316

Summary: Proxied SSI ProxyTimeout render failure
Product: Apache httpd-2 Reporter: Jem Rayfield <jem.rayfield>
Component: mod_proxyAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED LATER    
Severity: major CC: jem.rayfield
Priority: P2 Keywords: MassUpdate
Version: 2.2.10   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Jem Rayfield 2008-12-01 03:52:30 UTC
Hi,

It seems that the mod_proxy ProxyTimeout has a nasty side effect when it 
kicks in when used with proxied SSI. Everything after a proxied (and timed out) SSI is ignored and not rendered.

For example the following simple shtml -> 

<html> 
  <body> 
     <h1>SSI CGI via a proxy test</h1> 
     <!--#include virtual="test-include.html" --> 
     <!--#include virtual="proxy/cgi-bin/perl-sleep.cgi?${QUERY_STRING}" --> 
    <h1> 
      Content that must be displayed even after a proxy timeout 
    </h1> 
  </body> 
</html> 

Has render problems with the CGI is timedout via ProxyTimeOut.
It appear to interrupt the subsequent output filter on timeout? 

The proxy configuration is as follows -->
Apache 2.2.10 (SHTML+mod_proxy+SSI):80 --> Squid:3128 --> Apache 2.2.10(mod_cgi):8080 

   <Proxy balancer://squidbalancer> 
      BalancerMember http://localhost:3128/ 
      ProxySet lbmethod=bytraffic 
      ProxySet timeout=1 
    </Proxy> 
    ProxyTimeout 2 
    RewriteEngine On 
    RewriteRule ^/proxy/(.*) balancer://squidbalancer/$1 [P,QSA,L] 

If the ProxyTimeout kicks in before Squid+Apache/CGI returns the 
following is rendered: 

<html> 
 <body> 
 <h1>SSI CGI via a proxy test</h1> 
 <br/> 
             **MISSING HTML HERE** 

However when I increase the ProxyTimeout in order that Squid times 
out and not the calling Apache before the CGI returns the render looks a 
tad better. 

At least the full shtml is rendered. (Plus some horrid squid 
response). Please see below.

I need proxied server side includes where a ProxyTimeout ensures that the backend server does not consume and hold up all the requests/threads.


Please do let me have your thoughts 
Cheers
Jem


<html> 
 <body> 
 <h1>SSI CGI via a proxy test</h1> 
 <br/> 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd"> 
 <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; 
charset=iso-8859-1"> 
 <TITLE>ERROR: The requested URL could not be retrieved</TITLE> 
 <STYLE type="text/css"><!--BODY{background-color:#ffffff;font- 
family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> 
 </HEAD><BODY> 
 <H1>ERROR</H1> 
 <H2>The requested URL could not be retrieved</H2> 
 <HR noshade size="1px"> 
 <P> 
 While trying to retrieve the URL: 
 <A HREF="http://127.0.0.1//cgi-bin/perl-sleep.cgi?">http:// 
127.0.0.1// 
cgi-bin/perl-sleep.cgi?</A> 
 <P> 
 The following error was encountered: 
 <UL> 
 <LI> 
 <STRONG> 
 Read Timeout 
 </STRONG> 
 </UL> 
 <P> 
 The system returned: 
 <PRE><I> [No Error]</I></PRE> 
 <P> 
 A Timeout occurred while waiting to read data from the network. The 
network 
 or server may be down or congested. Please retry your request. 
 <P>Your cache administrator is <A 
HREF="mailto:webmaster">webmaster</ 
A>. 
 <BR clear="all"> 
 <HR noshade size="1px"> 
 <ADDRESS> 
 Generated Wed, 26 Nov 2008 12:19:09 GMT by PC- 
S043915.national.core.bbc.co.uk (squid/2.6.STABLE17) 
 </ADDRESS> 
 </BODY></HTML> 
 <h1> 
 Content that must be displayed even after a proxy timeout 
 </h1> 
 </body> 
 </html>
Comment 1 Jem Rayfield 2008-12-01 03:59:01 UTC
Hi,
It seems that the mod_proxy ProxyTimeout has a nasty side effect when it 
kicks in when used with proxied SSI. Everything after a proxied (and timed out)
SSI is ignored and not rendered.

For example the following simple shtml -> 

<html> 
  <body> 
     <h1>SSI CGI via a proxy test</h1> 
     <!--#include virtual="test-include.html" --> 
     <!--#include virtual="proxy/cgi-bin/perl-sleep.cgi?${QUERY_STRING}" --> 
    <h1> 
      Content that must be displayed even after a proxy timeout 
    </h1> 
  </body> 
</html> 

The above shtml has render problems when the CGI times out via ProxyTimeOut.
mod_proxy appears to interrupt the render and subsequent output filter on timeout? 

The proxy configuration is as follows --> Apache 2.2.10 (SHTML+mod_proxy+SSI):80 --> Squid:3128 --> Apache 2.2.10(mod_cgi):8080 

    <Proxy balancer://squidbalancer> 
       BalancerMember http://localhost:3128/ 
       ProxySet lbmethod=bytraffic 
       ProxySet timeout=1 
     </Proxy> 
     ProxyTimeout 2 
     RewriteEngine On 
     RewriteRule ^/proxy/(.*) balancer://squidbalancer/$1 [P,QSA,L] 

So as an example if the ProxyTimeout kicks in before Squid+Apache/CGI returns the following is rendered: 

 <html> 
  <body> 
  <h1>SSI CGI via a proxy test</h1> 
  <br/> 
              **MISSING HTML HERE** 

However when I increase the ProxyTimeout in order that Squid times 
out and not the calling Apache before the CGI returns the render looks a 
tad better. 
At least the full shtml is rendered. (Plus some horrid squid 
response). Please see below.
I need proxied server side includes where a ProxyTimeout ensures that the
backend server does not consume and hold up all the requests/threads.

Please do let me have your thoughts 
Cheers
Jem

 <html> 
  <body> 
  <h1>SSI CGI via a proxy test</h1> 
  <br/> 
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
 "http://www.w3.org/TR/html4/loose.dtd"> 
  <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; 
 charset=iso-8859-1"> 
  <TITLE>ERROR: The requested URL could not be retrieved</TITLE> 
  <STYLE type="text/css"><!--BODY{background-color:#ffffff;font- 
 family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> 
  </HEAD><BODY> 
  <H1>ERROR</H1> 
  <H2>The requested URL could not be retrieved</H2> 
  <HR noshade size="1px"> 
  <P> 
  While trying to retrieve the URL: 
  <A HREF="http://127.0.0.1//cgi-bin/perl-sleep.cgi?">http:// 
 127.0.0.1// 
 cgi-bin/perl-sleep.cgi?</A> 
  <P> 
  The following error was encountered: 
  <UL> 
  <LI> 
  <STRONG> 
  Read Timeout 
  </STRONG> 
  </UL> 
  <P> 
  The system returned: 
  <PRE><I> [No Error]</I></PRE> 
  <P> 
  A Timeout occurred while waiting to read data from the network. The 
 network 
  or server may be down or congested. Please retry your request. 
  <P>Your cache administrator is <A 
 HREF="mailto:webmaster">webmaster</ 
 A>. 
  <BR clear="all"> 
  <HR noshade size="1px"> 
  <ADDRESS> 
  Generated Wed, 26 Nov 2008 12:19:09 GMT by PC- > S043915.national.core.bbc.co.uk (squid/2.6.STABLE17) 
  </ADDRESS> 
  </BODY></HTML> 
  <h1> 
  Content that must be displayed even after a proxy timeout 
  </h1> 
  </body> 
  </html>
Comment 2 William A. Rowe Jr. 2018-11-07 21:10:03 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.