You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Phil Hanna <ph...@ipass.net> on 2000/08/13 03:23:57 UTC

Patch - fix available for Bug #7

I submitted this bug fix about eight days ago, both to the bug tracking system at znutar.cortexity.com and to this newsgroup.  Has any committer had a chance to take a look at it?

Handling requests from a servlet that has thrown a permanent UnavailableException in init() is clearly a bug.  The fix doesn't seem particularly dangerous.  Hasn' t anyone run into this before?


-----
Throwing a permanent UnavailableException from a servlet's init() method should prevent requests from being serviced, but it does not.  The org.apache.tomcat.core.ServletWrapper doInit() method does not take into account that getUnavailableSeconds() returns -1 for a permanent UnavailableException.

My fix applies to the service() method.  It already checks for the exception and retries if the (temporary) unavailable time limit has expired.  I added code to force a return with initialized=false if the exception is permanent.

BTW, I posted this as a comment to BugRat bug 7.  Is that the appropriate place to post a fix?  I wasn't sure, so I posted it here as well.

--- ServletWrapper.original Tue Aug 01 03:23:30 2000 
+++ ServletWrapper.java Fri Aug 04 06:12:23 2000 
@@ -353,6 +353,12 @@ 
  } 
  
  if( unavailable!=null  ) { 
+  // Don't load at all if permanently unavailable 
+  if (((UnavailableException) unavailable).getUnavailableSeconds() == -1) { 
+   initialized = false; 
+   return; 
+  } 
+ 
      // Don't load if Unavailable timer is in place 
      if(  stillUnavailable() ) { 
   handleUnavailable( req, res ); 

  

Re: Patch - fix available for Bug #7

Posted by Costin Manolache <cm...@yahoo.com>.
I'll check it in, thank you very much.

Costin

Phil Hanna wrote:

> I submitted this bug fix about eight days ago, both to the bug
> tracking system at znutar.cortexity.com and to this newsgroup.  Has
> any committer had a chance to take a look at it? Handling requests
> from a servlet that has thrown a permanent UnavailableException in
> init() is clearly a bug.  The fix doesn't seem particularly
> dangerous.  Hasn' t anyone run into this before?  -----Throwing a
> permanent UnavailableException from a servlet's init() method should
> prevent requests from being serviced, but it does not.  The
> org.apache.tomcat.core.ServletWrapper doInit() method does not take
> into account that getUnavailableSeconds() returns -1 for a permanent
> UnavailableException. My fix applies to the service() method.  It
> already checks for the exception and retries if the (temporary)
> unavailable time limit has expired.  I added code to force a return
> with initialized=false if the exception is permanent. BTW, I posted
> this as a comment to BugRat bug 7.  Is that the appropriate place to
> post a fix?  I wasn't sure, so I posted it here as well. ---
> ServletWrapper.original Tue Aug 01 03:23:30 2000
> +++ ServletWrapper.java Fri Aug 04 06:12:23 2000
> @@ -353,6 +353,12 @@
>   }
>
>   if( unavailable!=null  ) {
> +  // Don't load at all if permanently unavailable
> +  if (((UnavailableException) unavailable).getUnavailableSeconds() ==
> -1) {
> +   initialized = false;
> +   return;
> +  }
> +
>       // Don't load if Unavailable timer is in place
>       if(  stillUnavailable() ) {
>    handleUnavailable( req, res );