Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-1146

Better checks for broken pipe exceptions in DamDownloadServlet

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • DAM Core
    • None

      On Tomcat 9 broken pipe exceptions are (often? always?) thrown without setting partial content response code. Proposed patch fixes this.

      Subject: [PATCH] tomcat class patch
      ---
      Index: info/magnolia/dam/core/download/DamDownloadServlet.java
      IDEA additional info:
      Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
      <+>UTF-8
      ===================================================================
      diff --git a/info/magnolia/dam/core/download/DamDownloadServlet.java b/info/magnolia/dam/core/download/DamDownloadServlet.java
      --- a/info/magnolia/dam/core/download/DamDownloadServlet.java	(revision 06fa5448169640aa8d4471a3c994784e47ee3ed7)
      +++ b/info/magnolia/dam/core/download/DamDownloadServlet.java	(revision fd24dd353346cde6951828db43f71a02e1538959)
      @@ -78,6 +78,8 @@
       public class DamDownloadServlet extends HttpServlet implements SelfMappingServlet {
           private static final Logger log = LoggerFactory.getLogger(DamDownloadServlet.class);
       
      +    private static final String CLIENT_ABORT_CLASS = "org.apache.catalina.connector.ClientAbortException";
      +
           static final String CONTENT_DISPOSITION = "Content-Disposition";
           static final String LAST_MODIFIED = "Last-Modified";
       
      @@ -194,7 +196,8 @@
                   }
                   // re-throw exception only if it's not a partial content response, else logs would fill up with (harmless)
                   // broken pipe exceptions on some app servers (e.g. Tomcat)
      -            if (res.getStatus() != HttpServletResponse.SC_PARTIAL_CONTENT) {
      +            if (res.getStatus() != HttpServletResponse.SC_PARTIAL_CONTENT &&
      +                    !CLIENT_ABORT_CLASS.equals(e.getClass().getName())) {
                      throw e;
                   }
               } finally {
      

        Acceptance criteria

          1.
          Implementation Sub-task To Do Unassigned
          2.
          Review Sub-task To Do Unassigned
          3.
          Pre-Integration QA Sub-task To Do Unassigned
          4.
          QA Sub-task To Do Unassigned

              Unassigned Unassigned
              msiradzki Marzena Sieradzka
              AuthorX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Task DoD