On 12/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
so what you fix was nothing.
You still get swamped in exceptions on jetty for OSX and now also others
that do throw
the right socket exception are getting swamped with exceptions.

No, because I log a warning exluding the exception. But fine, I agree
this fix isn't good either. We should look at something that fixes
more than just a corner case or two though.

As i said. sending a status code doesn't make any sense. because the
response is already broken.

No, I set the status code, which is something else then calling sendError.

Btw, we better discuss this on http://issues.apache.org/jira/browse/WICKET-144


Eelco


johan



On 12/6/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
>
> It just didn't work. It didn't work for Jetty on Linux and OSX, but it
> did for Jetty on Windows. Jetty throws an EofException, which extends
> IOException. And we were getting swamped with exceptions. That piece
> of code only caught a number of cases it seems. I see the fix isn't
> correct either, so we can revert, BUT it has to be combined with
> something that works for more cases. What servers did you test this
> piece of code on anyway? Just Tomcat on Windows? I we want to catch
> those particulars, we better make sure it is really well tested this
> time, on as many appserver/ platform combinations we can. Isn't there
> a better solution for this? Surely this has been a problem for more
> people/ frameworks?
>
> Eelco
>
>
> On 12/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
> > I am not happy with this change.
> >
> > We should try to ignore the client abort or connection reset as much as
> we
> > can
> > Now the log will be completely filled with exceptions you don't have
> > anything.
> >
> > Sending a http response error/status code is by the way not possible
> then
> > because the connection is reset!
> > you can't send anything to it!!
> >
> > Please revert this piece of code that we try to igore that as good as we
> > can.
> >
> > johan
> >
> >
> > On 12/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >
> > > Author: ehillenius
> > > Date: Tue Dec  5 17:50:11 2006
> > > New Revision: 482863
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=482863
> > > Log:
> > > WICKET-144
> > >
> > > Modified:
> > >     incubator/wicket/branches/wicket-1.2.x
> > > /wicket/src/main/java/wicket/Resource.java
> > >     incubator/wicket/branches/wicket-1.2.x
> > >
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > >     incubator/wicket/branches/wicket-1.x
> > > /wicket/src/main/java/wicket/Resource.java
> > >     incubator/wicket/branches/wicket-1.x
> > >
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > >     incubator/wicket/trunk/wicket/src/main/java/wicket/Resource.java
> > >
> > >
> 
incubator/wicket/trunk/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > >
> > > Modified: incubator/wicket/branches/wicket-1.2.x
> > > /wicket/src/main/java/wicket/Resource.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/Resource.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/branches/wicket-1.2.x
> /wicket/src/main/java/wicket/Resource.java
> > > (original)
> > > +++ incubator/wicket/branches/wicket-1.2.x
> /wicket/src/main/java/wicket/Resource.java
> > > Tue Dec  5 17:50:11 2006
> > > @@ -18,7 +18,6 @@
> > > package wicket;
> > >
> > > import java.io.OutputStream;
> > > -import java.net.SocketException;
> > > import java.util.Map;
> > >
> > > import org.apache.commons.logging.Log;
> > > @@ -83,7 +82,7 @@
> > >                 // By default all resources are cacheable
> > >                 cacheable = true;
> > >         }
> > > -
> > > +
> > >         /**
> > >          * @return Gets the resource to render to the requester
> > >          */
> > > @@ -247,38 +246,7 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       Throwable throwable = e;
> > > -                       boolean ignoreException = false;
> > > -                       while (throwable != null)
> > > -                       {
> > > -                               if (throwable instanceof
> SocketException)
> > > -                               {
> > > -                                       String message =
> > > throwable.getMessage();
> > > -                                       ignoreException = message !=
> null
> > > -                                                       && (
> > > message.indexOf("Connection reset by peer") != -1 || message
> > > -
> > > .indexOf("Software caused connection abort") != -1);
> > > -                               }
> > > -                               else
> > > -                               {
> > > -                                       ignoreException =
> > > throwable.getClass().getName()
> > > -
> > > .indexOf("ClientAbortException") >= 0;
> > > -                                       if (ignoreException)
> > > -                                       {
> > > -                                               if (log.isDebugEnabled
> ())
> > > -                                               {
> > > -                                                       log.debug
> ("Socket
> > > exception ignored for sending Resource "
> > >
> -                                                                       +
> > > "response to client (ClientAbort)", e);
> > > -                                               }
> > > -                                               break;
> > > -                                       }
> > > -                               }
> > > -                               throwable = throwable.getCause();
> > > -                       }
> > > -                       if (!ignoreException)
> > > -                       {
> > > -                               throw new
> WicketRuntimeException("Unable
> > > to render resource stream "
> > > -                                               + resourceStream, e);
> > > -                       }
> > > +                       throw new WicketRuntimeException(e);
> > >                 }
> > >         }
> > > }
> > >
> > > Modified: incubator/wicket/branches/wicket-1.2.x
> > >
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.2.x/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/branches/wicket-1.2.x
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > (original)
> > > +++ incubator/wicket/branches/wicket-1.2.x
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > Tue Dec  5 17:50:11 2006
> > > @@ -17,12 +17,19 @@
> > >   */
> > > package wicket.request.target.resource;
> > >
> > > +import javax.servlet.http.HttpServletResponse;
> > > +
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +
> > > import wicket.Component;
> > > import wicket.IRequestTarget;
> > > import wicket.Page;
> > > import wicket.RequestCycle;
> > > import wicket.RequestListenerInterface;
> > > +import wicket.Response;
> > > import wicket.WicketRuntimeException;
> > > +import wicket.protocol.http.WebResponse;
> > >
> > > /**
> > >   * An implemenation of IRequestTarget that is used for the
> > > IResourceListener
> > > @@ -32,6 +39,8 @@
> > >   */
> > > public final class ComponentResourceRequestTarget implements
> > > IRequestTarget
> > > {
> > > +       private static final Log log = LogFactory.getLog(
> > > ComponentResourceRequestTarget.class);
> > > +
> > >         private final Page page;
> > >         private final Component component;
> > >         private final RequestListenerInterface listener;
> > > @@ -65,9 +74,22 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       throw new WicketRuntimeException("method " +
> > > listener.getName() + " of "
> > > -                                       + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component " + component
> > > -                                       + " threw an exception", e);
> > > +                       Response response = requestCycle.getResponse
> ();
> > > +                       if (response instanceof WebResponse)
> > > +                       {
> > > +
> > > ((WebResponse)response).getHttpServletResponse().setStatus(
> > > +
> > > HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
> > > +                               log.error("error handling resource
> request
> > > for component " + component
> > > +                                               + ", on page " + page
> + ",
> > > listener " + listener.getName() + " - "
> > > +                                               + e.getMessage());
> > > +                               return;
> > > +                       }
> > > +                       else
> > > +                       {
> > > +                               throw new
> WicketRuntimeException("method "
> > > + listener.getName() + " of "
> > > +                                               + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component "
> > > +                                               + component + " threw
> an
> > > exception", e);
> > > +                       }
> > >                 }
> > >                 finally
> > >                 {
> > >
> > > Modified: incubator/wicket/branches/wicket-1.x
> > > /wicket/src/main/java/wicket/Resource.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Resource.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/branches/wicket-1.x
> /wicket/src/main/java/wicket/Resource.java
> > > (original)
> > > +++ incubator/wicket/branches/wicket-1.x
> /wicket/src/main/java/wicket/Resource.java
> > > Tue Dec  5 17:50:11 2006
> > > @@ -17,7 +17,6 @@
> > > package wicket;
> > >
> > > import java.io.OutputStream;
> > > -import java.net.SocketException;
> > > import java.util.Map;
> > >
> > > import org.apache.commons.logging.Log;
> > > @@ -82,7 +81,7 @@
> > >                 // By default all resources are cacheable
> > >                 cacheable = true;
> > >         }
> > > -
> > > +
> > >         /**
> > >          * @return Gets the resource to render to the requester
> > >          */
> > > @@ -246,38 +245,7 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       Throwable throwable = e;
> > > -                       boolean ignoreException = false;
> > > -                       while (throwable != null)
> > > -                       {
> > > -                               if (throwable instanceof
> SocketException)
> > > -                               {
> > > -                                       String message =
> > > throwable.getMessage();
> > > -                                       ignoreException = message !=
> null
> > > -                                                       && (
> > > message.indexOf("Connection reset by peer") != -1 || message
> > > -
> > > .indexOf("Software caused connection abort") != -1);
> > > -                               }
> > > -                               else
> > > -                               {
> > > -                                       ignoreException =
> > > throwable.getClass().getName()
> > > -
> > > .indexOf("ClientAbortException") >= 0;
> > > -                                       if (ignoreException)
> > > -                                       {
> > > -                                               if (log.isDebugEnabled
> ())
> > > -                                               {
> > > -                                                       log.debug
> ("Socket
> > > exception ignored for sending Resource "
> > >
> -                                                                       +
> > > "response to client (ClientAbort)", e);
> > > -                                               }
> > > -                                               break;
> > > -                                       }
> > > -                               }
> > > -                               throwable = throwable.getCause();
> > > -                       }
> > > -                       if (!ignoreException)
> > > -                       {
> > > -                               throw new
> WicketRuntimeException("Unable
> > > to render resource stream "
> > > -                                               + resourceStream, e);
> > > -                       }
> > > +                       throw new WicketRuntimeException(e);
> > >                 }
> > >         }
> > > }
> > >
> > > Modified: incubator/wicket/branches/wicket-1.x
> > >
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/branches/wicket-1.x
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > (original)
> > > +++ incubator/wicket/branches/wicket-1.x
> 
/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > Tue Dec  5 17:50:11 2006
> > > @@ -17,12 +17,19 @@
> > >   */
> > > package wicket.request.target.resource;
> > >
> > > +import javax.servlet.http.HttpServletResponse;
> > > +
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +
> > > import wicket.Component;
> > > import wicket.IRequestTarget;
> > > import wicket.Page;
> > > import wicket.RequestCycle;
> > > import wicket.RequestListenerInterface;
> > > +import wicket.Response;
> > > import wicket.WicketRuntimeException;
> > > +import wicket.protocol.http.WebResponse;
> > >
> > > /**
> > >   * An implemenation of IRequestTarget that is used for the
> > > IResourceListener
> > > @@ -32,6 +39,8 @@
> > >   */
> > > public final class ComponentResourceRequestTarget implements
> > > IRequestTarget
> > > {
> > > +       private static final Log log = LogFactory.getLog(
> > > ComponentResourceRequestTarget.class);
> > > +
> > >         private final Page page;
> > >         private final Component component;
> > >         private final RequestListenerInterface listener;
> > > @@ -65,9 +74,22 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       throw new WicketRuntimeException("method " +
> > > listener.getName() + " of "
> > > -                                       + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component " + component
> > > -                                       + " threw an exception", e);
> > > +                       Response response = requestCycle.getResponse
> ();
> > > +                       if (response instanceof WebResponse)
> > > +                       {
> > > +
> > > ((WebResponse)response).getHttpServletResponse().setStatus(
> > > +
> > > HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
> > > +                               log.error("error handling resource
> request
> > > for component " + component
> > > +                                               + ", on page " + page
> + ",
> > > listener " + listener.getName() + " - "
> > > +                                               + e.getMessage());
> > > +                               return;
> > > +                       }
> > > +                       else
> > > +                       {
> > > +                               throw new
> WicketRuntimeException("method "
> > > + listener.getName() + " of "
> > > +                                               + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component "
> > > +                                               + component + " threw
> an
> > > exception", e);
> > > +                       }
> > >                 }
> > >                 finally
> > >                 {
> > >
> > > Modified:
> incubator/wicket/trunk/wicket/src/main/java/wicket/Resource.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/Resource.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/trunk/wicket/src/main/java/wicket/Resource.java
> > > (original)
> > > +++ incubator/wicket/trunk/wicket/src/main/java/wicket/Resource.java
> Tue
> > > Dec  5 17:50:11 2006
> > > @@ -17,7 +17,6 @@
> > > package wicket;
> > >
> > > import java.io.OutputStream;
> > > -import java.net.SocketException;
> > > import java.util.Map;
> > >
> > > import org.apache.commons.logging.Log;
> > > @@ -246,38 +245,7 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       Throwable throwable = e;
> > > -                       boolean ignoreException = false;
> > > -                       while (throwable != null)
> > > -                       {
> > > -                               if (throwable instanceof
> SocketException)
> > > -                               {
> > > -                                       String message =
> > > throwable.getMessage();
> > > -                                       ignoreException = message !=
> null
> > > -                                                       && (
> > > message.indexOf("Connection reset by peer") != -1 || message
> > > -
> > > .indexOf("Software caused connection abort") != -1);
> > > -                               }
> > > -                               else
> > > -                               {
> > > -                                       ignoreException =
> > > throwable.getClass().getName()
> > > -
> > > .indexOf("ClientAbortException") >= 0;
> > > -                                       if (ignoreException)
> > > -                                       {
> > > -                                               if (log.isDebugEnabled
> ())
> > > -                                               {
> > > -                                                       log.debug
> ("Socket
> > > exception ignored for sending Resource "
> > >
> -                                                                       +
> > > "response to client (ClientAbort)", e);
> > > -                                               }
> > > -                                               break;
> > > -                                       }
> > > -                               }
> > > -                               throwable = throwable.getCause();
> > > -                       }
> > > -                       if (!ignoreException)
> > > -                       {
> > > -                               throw new
> WicketRuntimeException("Unable
> > > to render resource stream "
> > > -                                               + resourceStream, e);
> > > -                       }
> > > +                       throw new WicketRuntimeException(e);
> > >                 }
> > >         }
> > > }
> > >
> > > Modified:
> > >
> 
incubator/wicket/trunk/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > URL:
> > >
> 
http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java?view=diff&rev=482863&r1=482862&r2=482863
> > >
> > >
> ==============================================================================
> > > ---
> > >
> 
incubator/wicket/trunk/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > (original)
> > > +++
> > >
> 
incubator/wicket/trunk/wicket/src/main/java/wicket/request/target/resource/ComponentResourceRequestTarget.java
> > > Tue Dec  5 17:50:11 2006
> > > @@ -17,12 +17,19 @@
> > >   */
> > > package wicket.request.target.resource;
> > >
> > > +import javax.servlet.http.HttpServletResponse;
> > > +
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > > +
> > > import wicket.Component;
> > > import wicket.IRequestTarget;
> > > import wicket.Page;
> > > import wicket.RequestCycle;
> > > import wicket.RequestListenerInterface;
> > > +import wicket.Response;
> > > import wicket.WicketRuntimeException;
> > > +import wicket.protocol.http.WebResponse;
> > >
> > > /**
> > >   * An implemenation of IRequestTarget that is used for the
> > > IResourceListener
> > > @@ -32,6 +39,8 @@
> > >   */
> > > public final class ComponentResourceRequestTarget implements
> > > IRequestTarget
> > > {
> > > +       private static final Log log = LogFactory.getLog(
> > > ComponentResourceRequestTarget.class);
> > > +
> > >         private final Page page;
> > >         private final Component component;
> > >         private final RequestListenerInterface listener;
> > > @@ -65,9 +74,22 @@
> > >                 }
> > >                 catch (Exception e)
> > >                 {
> > > -                       throw new WicketRuntimeException("method " +
> > > listener.getName() + " of "
> > > -                                       + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component "
> > > -                                       + component + " threw an
> > > exception", e);
> > > +                       Response response = requestCycle.getResponse
> ();
> > > +                       if (response instanceof WebResponse)
> > > +                       {
> > > +
> > > ((WebResponse)response).getHttpServletResponse().setStatus(
> > > +
> > > HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
> > > +                               log.error("error handling resource
> request
> > > for component " + component
> > > +                                               + ", on page " + page
> + ",
> > > listener " + listener.getName() + " - "
> > > +                                               + e.getMessage());
> > > +                               return;
> > > +                       }
> > > +                       else
> > > +                       {
> > > +                               throw new
> WicketRuntimeException("method "
> > > + listener.getName() + " of "
> > > +                                               + listener.getMethod
> ().getDeclaringClass()
> > > + " targetted at component "
> > > +                                               + component + " threw
> an
> > > exception", e);
> > > +                       }
> > >                 }
> > >                 finally
> > >                 {
> > >
> > >
> > >
> >
> >
>


Reply via email to