You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2015/07/30 17:58:19 UTC
SlingMainServlet (almost) eats IOException, how to fix?
Hi,
Since SLING-3498 the SlingMainServlet.service method does this:
try {
...do request processing
} catch (IOException ioe) {
log.debug("service: Probably client aborted request or any other
network problem", ioe);
} catch (Throwable T) {
log.error(...
The idea was to avoid polluting the logs with IOException caused by
clients disconnecting prematurely or other network issues.
The problem is that this causes legit IOExceptions throwed by request
processing code to be logged at the debug level only, so effectively
hidden on production systems.
What do people think of changing that catch clause to
} catch (IOException ioe) {
log.error("service: IOException in request processing", ioe);
I think a bit of noise in the logs is better than hiding exceptions
thrown by application code.
Any better ideas?
-Bertrand
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Jul 31, 2015 at 3:30 PM, Robert Munteanu <ro...@apache.org> wrote:
> ...Isn't that a Tomcat-specific exception [1]? It would be interesting to
> see how they detect that this is due to the client aborting and
> reuse/copy that approach...
Good idea, I'll have a look. We did have special processing for
SocketException earlier in SlingMainServlet but apparently that
doesn't work anymore with modern servlet engines.
-Bertrand
> [1]: https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/c
> onnector/ClientAbortException.html
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Jul 31, 2015 at 3:30 PM, Robert Munteanu <ro...@apache.org> wrote:
> ...It would be interesting to see how Tomcat detects that this is due to the
> client aborting...
I have attached a proposed Sling engine patch to
https://issues.apache.org/jira/browse/SLING-4921 using the same
technique as Tomcat, wrapping IOException in a ClientAbortException in
places where we write to the client and catching that
ClientAbortException in SlingMainServlet.
My tests look good with that patch but I have only implemented that
for RequestLoggerResponse.LoggerResponseOutputStream so far, do people
think we need ClientAbortException wrapping in other places?
-Bertrand
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Robert Munteanu <ro...@apache.org>.
On Fri, 2015-07-31 at 15:20 +0200, Carsten Ziegeler wrote:
> Am 31.07.15 um 15:14 schrieb Varun Nagpal:
> > Wouldn't that be
> >
> > ClientAbortException: java.net.SocketException: Broken pipe
> >
> Yepp, I think thats the one.
Isn't that a Tomcat-specific exception [1]? It would be interesting to
see how they detect that this is due to the client aborting and
reuse/copy that approach.
Robert
[1]: https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/c
onnector/ClientAbortException.html
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Carsten Ziegeler <cz...@apache.org>.
Am 31.07.15 um 15:14 schrieb Varun Nagpal:
> Wouldn't that be
>
> ClientAbortException: java.net.SocketException: Broken pipe
>
Yepp, I think thats the one.
Thanks Varin
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Varun Nagpal <va...@gmail.com>.
Wouldn't that be
ClientAbortException: java.net.SocketException: Broken pipe
--
Varun
On Fri, Jul 31, 2015 at 11:39 AM, Carsten Ziegeler <cz...@apache.org>
wrote:
> I would assume that there is some subclass of IOException thrown in the
> cases where the client disconnects. So we could ignore just those?
>
> Carsten
>
> Am 30.07.15 um 17:58 schrieb Bertrand Delacretaz:
> > Hi,
> >
> > Since SLING-3498 the SlingMainServlet.service method does this:
> >
> > try {
> > ...do request processing
> > } catch (IOException ioe) {
> > log.debug("service: Probably client aborted request or any other
> > network problem", ioe);
> > } catch (Throwable T) {
> > log.error(...
> >
> > The idea was to avoid polluting the logs with IOException caused by
> > clients disconnecting prematurely or other network issues.
> >
> > The problem is that this causes legit IOExceptions throwed by request
> > processing code to be logged at the debug level only, so effectively
> > hidden on production systems.
> >
> > What do people think of changing that catch clause to
> >
> > } catch (IOException ioe) {
> > log.error("service: IOException in request processing", ioe);
> >
> > I think a bit of noise in the logs is better than hiding exceptions
> > thrown by application code.
> >
> > Any better ideas?
> >
> > -Bertrand
> >
>
>
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>
Re: SlingMainServlet (almost) eats IOException, how to fix?
Posted by Carsten Ziegeler <cz...@apache.org>.
I would assume that there is some subclass of IOException thrown in the
cases where the client disconnects. So we could ignore just those?
Carsten
Am 30.07.15 um 17:58 schrieb Bertrand Delacretaz:
> Hi,
>
> Since SLING-3498 the SlingMainServlet.service method does this:
>
> try {
> ...do request processing
> } catch (IOException ioe) {
> log.debug("service: Probably client aborted request or any other
> network problem", ioe);
> } catch (Throwable T) {
> log.error(...
>
> The idea was to avoid polluting the logs with IOException caused by
> clients disconnecting prematurely or other network issues.
>
> The problem is that this causes legit IOExceptions throwed by request
> processing code to be logged at the debug level only, so effectively
> hidden on production systems.
>
> What do people think of changing that catch clause to
>
> } catch (IOException ioe) {
> log.error("service: IOException in request processing", ioe);
>
> I think a bit of noise in the logs is better than hiding exceptions
> thrown by application code.
>
> Any better ideas?
>
> -Bertrand
>
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org