[MGNLDAM-1146] Better checks for broken pipe exceptions in DamDownloadServlet Created: 31/Mar/23 Updated: 13/Apr/23 |
|
| Status: | Open |
| Project: | Magnolia DAM Module |
| Component/s: | DAM Core |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Marzena Sieradzka | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Sub-Tasks: |
|
|||||||||||||||||||||||||
| Template: | ||||||||||||||||||||||||||
| Patch included: |
Yes
|
|||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
|||||||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
|||||||||||||||||||||||||
| Epic Link: | AuthorX Support | |||||||||||||||||||||||||
| Team: |
| Description |
|
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 { |