tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4 Ajp13Processor.java
Date Thu, 02 Jan 2003 12:57:53 GMT
glenn       2003/01/02 04:57:53

  Modified:    jk/java/org/apache/ajp/tomcat4 Ajp13Processor.java
  Log:
  Make sure Ajp never gets hung due to an Exception
  
  Revision  Changes    Path
  1.11      +28 -11    jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Processor.java
  
  Index: Ajp13Processor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Processor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Ajp13Processor.java	30 Dec 2002 16:00:32 -0000	1.10
  +++ Ajp13Processor.java	2 Jan 2003 12:57:53 -0000	1.11
  @@ -462,9 +462,23 @@
                   }
   
                   if (!bad_request) {
  -                    connector.getContainer().invoke(request, response);
  +                    try {
  +                        connector.getContainer().invoke(request, response);
  +                    } catch (IOException ioe) {
  +                        // Pass the IOException through
  +                        throw ioe;
  +                    } catch (Throwable e) {
  +                        // A throwable here could be caused by a Valve,
  +                        // Filter, or other component in the chain.
  +                        // Processing of the request failed, return an
  +                        // Internal Server Error
  +                        logger.log("process: invoke", e);
  +                        response.sendError
  +                            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +                    }
                   } else {
  -                    response.sendError(400);
  +                    response.sendError
  +                        (HttpServletResponse.SC_BAD_REQUEST);
                   }
   
                   if (debug > 0) {
  @@ -480,13 +494,16 @@
   
               } catch (IOException ioe) {
                   // Normally this catches a socket Broken Pipe caused by the
  -                // remote client aborting the request. mod_jk will close the
  -                // socket on its side and the processor will get a socket EOF
  -                // when it next tries to read from mod_jk, then recycle itself
  -                // normally. Don't print the stack trace in this case.
  +                // remote client aborting the request. Don't print the stack
  +                // trace in this case. Then let the Processor recycle.
                   logger.log("process: IOException " + ioe.getMessage());
  +                moreRequests = false;
               } catch (Throwable e) {
  -                logger.log("process: invoke", e);
  +                // Processing the request and sending the response failed.
  +                // We don't know what the state of the Ajp Connector socket
  +                // is in. Bail out and recycle the Processor.
  +                logger.log("process: finish", e);
  +                moreRequests = false;
               }
   
               // Recycling the request and the response objects
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message