tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
Date Fri, 12 Sep 2003 08:38:53 GMT

----- Original Message ----- 
From: "Stefan Bodewig" <bodewig@apache.org>
To: <tomcat-dev@jakarta.apache.org>
Sent: Friday, September 12, 2003 12:58 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net
PoolTcpEndpoint.java


> On 12 Sep 2003, <billbarker@apache.org> wrote:
>
> >  +++ PoolTcpEndpoint.java 12 Sep 2003 03:51:36 -0000 1.16
> >  @@ -389,12 +389,12 @@
> >               if (accepted != null) {
> >                   try {
> >                       accepted.close();
> >  -                    accepted = null;
> >                   } catch(Exception ex) {
> >                       msg = sm.getString("endpoint.err.nonfatal",
> >                                          accepted, ex);
> >                       log.warn(msg, ex);
> >                   }
> >  +                accepted = null;
> >               }
> >
> >               if( ! running ) return null;
>
> wouldn't it be better to put the "accepted = null" into a finally
> block so you clean up even in the (unlikely but possible) case where
> close throws an Error (or Throwable) instead of an Exception?
>

Wouldn't do anything.  The 'accepted' variable is local to the stack-frame,
so it goes away if I throw clear of the method.  In this case you just get a
DoS condition where no threads are listening on the ServerSocket.  I briefly
thought about changing the catch to 'Throwable', but is it really possible
for Socket.close to throw anything other than an Exception?


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


Mime
View raw message