Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3498

Don't log stacktrace on IOException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Engine 2.3.2
    • Engine 2.3.4
    • Engine
    • None

    Description

      The SlingMainServlet logs IOExceptions depending on the actual cause:

      } catch (IOException ioe) {
          // unwrap any causes (Jetty wraps SocketException in
          // EofException)
          Throwable cause = ioe;
          while (cause.getCause() != null) {
              cause = cause.getCause();
          }
          if (cause instanceof SocketException) {
              // if the cause is a SocketException, the client most
              // probably
              // aborted the request, we do not fill the log with errors
              // in this case
              log.debug(
                  "service: Socketexception (Client abort or network problem",
                  ioe);
          } else {
              // otherwise we want to know why the servlet failed
              log.error(
                  "service: Uncaught IO Problem while handling the request",
                  ioe);
          }
      } ...
      

      The idea is to try to find out, whether the IOException is caused by the client aborting the request or some other problem.

      NIO socket channels, though, don't throw SocketException but just IOException in this case, so this above code will always log an ERROR message with a stack trace. This message has no real use and we should change this and log the IOException as an INFO message (if at all) and at most dump the stack trace as a DEBUG message.

      Attachments

        Issue Links

          Activity

            People

              fmeschbe Felix Meschberger
              fmeschbe Felix Meschberger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: