[tomcat] 02/03: Improve handling of failures during recycle() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 30f8063d7a9b4c43ae4722f5e382a76af1d7a6bf Author: Mark Thomas AuthorDate: Thu Oct 5 20:52:46 2023 +0100 Improve handling of failures during recycle() methods --- .../org/apache/catalina/connector/LocalStrings.properties | 1 + java/org/apache/catalina/connector/Request.java | 7 --- java/org/apache/catalina/core/ApplicationHttpRequest.java | 8 +++- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/LocalStrings_es.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_fr.properties | 1 + java/org/apache/catalina/core/LocalStrings_ja.properties | 1 + java/org/apache/catalina/core/LocalStrings_ko.properties | 1 + .../apache/catalina/core/LocalStrings_zh_CN.properties| 1 + java/org/apache/tomcat/util/buf/B2CConverter.java | 11 ++- java/org/apache/tomcat/util/buf/C2BConverter.java | 15 ++- java/org/apache/tomcat/util/buf/LocalStrings.properties | 3 +++ webapps/docs/changelog.xml| 4 13 files changed, 50 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index f511e2e836..945e7b88f1 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -51,6 +51,7 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request. coyoteRequest.chunkedPostTooLarge=Parameters were not parsed because the size of the posted data was too big. Because this request was a chunked request, it could not be processed further. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. +coyoteRequest.deletePartFailed=Failed to deleted temporary file used for part [{0}] coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}] coyoteRequest.getInputStream.ise=getReader() has already been called for this request diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 6055001b98..dcf037a140 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -466,8 +466,9 @@ public class Request implements HttpServletRequest { for (Part part : parts) { try { part.delete(); -} catch (IOException ignored) { -// ApplicationPart.delete() never throws an IOEx +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); +log.warn(sm.getString("coyoteRequest.deletePartFailed", part.getName()), t); } } parts = null; @@ -520,8 +521,8 @@ public class Request implements HttpServletRequest { asyncSupported = null; if (asyncContext != null) { asyncContext.recycle(); +asyncContext = null; } -asyncContext = null; } diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index c7f61d816b..c45f895819 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -45,6 +45,7 @@ import org.apache.catalina.connector.RequestFacade; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.URLEncoder; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.Parameters; @@ -613,7 +614,12 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { */ public void recycle() { if (session != null) { -session.endAccess(); +try { +session.endAccess(); +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); + context.getLogger().warn(sm.getString("applicationHttpRequest.sessionEndAccessFail"), t); +} } } diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties
[tomcat] 02/03: Improve handling of failures during recycle() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 44d05d75d696ca10ce251e4e370511e38f20ae75 Author: Mark Thomas AuthorDate: Thu Oct 5 20:52:46 2023 +0100 Improve handling of failures during recycle() methods --- .../org/apache/catalina/connector/LocalStrings.properties | 1 + java/org/apache/catalina/connector/Request.java | 7 --- java/org/apache/catalina/core/ApplicationHttpRequest.java | 8 +++- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/LocalStrings_cs.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_es.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_fr.properties | 1 + java/org/apache/catalina/core/LocalStrings_ja.properties | 1 + java/org/apache/catalina/core/LocalStrings_ko.properties | 1 + .../apache/catalina/core/LocalStrings_zh_CN.properties| 1 + java/org/apache/tomcat/util/buf/B2CConverter.java | 11 ++- java/org/apache/tomcat/util/buf/C2BConverter.java | 15 ++- java/org/apache/tomcat/util/buf/LocalStrings.properties | 3 +++ webapps/docs/changelog.xml| 4 14 files changed, 52 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index eba56eb075..df1de99f90 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -51,6 +51,7 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request. coyoteRequest.chunkedPostTooLarge=Parameters were not parsed because the size of the posted data was too big. Because this request was a chunked request, it could not be processed further. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. +coyoteRequest.deletePartFailed=Failed to deleted temporary file used for part [{0}] coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}] coyoteRequest.getInputStream.ise=getReader() has already been called for this request diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 2305d147f4..e5fb06f152 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -473,8 +473,9 @@ public class Request implements HttpServletRequest { for (Part part : parts) { try { part.delete(); -} catch (IOException ignored) { -// ApplicationPart.delete() never throws an IOEx +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); +log.warn(sm.getString("coyoteRequest.deletePartFailed", part.getName()), t); } } parts = null; @@ -527,8 +528,8 @@ public class Request implements HttpServletRequest { asyncSupported = null; if (asyncContext != null) { asyncContext.recycle(); +asyncContext = null; } -asyncContext = null; } diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index aa81c1196d..cc86ba88db 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -48,6 +48,7 @@ import org.apache.catalina.connector.RequestFacade; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.URLEncoder; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.Parameters; @@ -618,7 +619,12 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { */ public void recycle() { if (session != null) { -session.endAccess(); +try { +session.endAccess(); +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); + context.getLogger().warn(sm.getString("applicationHttpRequest.sessionEndAccessFail"), t); +} } } diff --git
[tomcat] 02/03: Improve handling of failures during recycle() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 9375d67106f8df9eb9d7b360b2bef052fe67d3d4 Author: Mark Thomas AuthorDate: Thu Oct 5 20:52:46 2023 +0100 Improve handling of failures during recycle() methods --- .../org/apache/catalina/connector/LocalStrings.properties | 1 + java/org/apache/catalina/connector/Request.java | 7 --- java/org/apache/catalina/core/ApplicationHttpRequest.java | 8 +++- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/LocalStrings_cs.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_es.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_fr.properties | 1 + java/org/apache/catalina/core/LocalStrings_ja.properties | 1 + java/org/apache/catalina/core/LocalStrings_ko.properties | 1 + .../apache/catalina/core/LocalStrings_zh_CN.properties| 1 + java/org/apache/tomcat/util/buf/B2CConverter.java | 11 ++- java/org/apache/tomcat/util/buf/C2BConverter.java | 15 ++- java/org/apache/tomcat/util/buf/LocalStrings.properties | 3 +++ webapps/docs/changelog.xml| 4 14 files changed, 52 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index 2b0e8c6998..1efd59b6b5 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -49,6 +49,7 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request. coyoteRequest.chunkedPostTooLarge=Parameters were not parsed because the size of the posted data was too big. Because this request was a chunked request, it could not be processed further. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. +coyoteRequest.deletePartFailed=Failed to deleted temporary file used for part [{0}] coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}] coyoteRequest.getInputStream.ise=getReader() has already been called for this request diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 77f7c18bbc..88bb9bc822 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -444,8 +444,9 @@ public class Request implements HttpServletRequest { for (Part part : parts) { try { part.delete(); -} catch (IOException ignored) { -// ApplicationPart.delete() never throws an IOEx +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); +log.warn(sm.getString("coyoteRequest.deletePartFailed", part.getName()), t); } } parts = null; @@ -498,8 +499,8 @@ public class Request implements HttpServletRequest { asyncSupported = null; if (asyncContext != null) { asyncContext.recycle(); +asyncContext = null; } -asyncContext = null; } diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index 1b93479d32..494f4a41cd 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -48,6 +48,7 @@ import org.apache.catalina.connector.RequestFacade; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.URLEncoder; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.Parameters; @@ -618,7 +619,12 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { */ public void recycle() { if (session != null) { -session.endAccess(); +try { +session.endAccess(); +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); + context.getLogger().warn(sm.getString("applicationHttpRequest.sessionEndAccessFail"), t); +} } } diff --git
[tomcat] 02/03: Improve handling of failures during recycle() methods
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d6db22e411307c97ddf78315c15d5889356eca38 Author: Mark Thomas AuthorDate: Thu Oct 5 20:52:46 2023 +0100 Improve handling of failures during recycle() methods --- .../org/apache/catalina/connector/LocalStrings.properties | 1 + java/org/apache/catalina/connector/Request.java | 7 --- java/org/apache/catalina/core/ApplicationHttpRequest.java | 8 +++- java/org/apache/catalina/core/LocalStrings.properties | 1 + java/org/apache/catalina/core/LocalStrings_cs.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_es.properties | 2 ++ java/org/apache/catalina/core/LocalStrings_fr.properties | 1 + java/org/apache/catalina/core/LocalStrings_ja.properties | 1 + java/org/apache/catalina/core/LocalStrings_ko.properties | 1 + .../apache/catalina/core/LocalStrings_zh_CN.properties| 1 + java/org/apache/tomcat/util/buf/B2CConverter.java | 11 ++- java/org/apache/tomcat/util/buf/C2BConverter.java | 15 ++- java/org/apache/tomcat/util/buf/LocalStrings.properties | 3 +++ webapps/docs/changelog.xml| 4 14 files changed, 52 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index b278705d74..077cf46136 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -50,6 +50,7 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request. coyoteRequest.chunkedPostTooLarge=Parameters were not parsed because the size of the posted data was too big. Because this request was a chunked request, it could not be processed further. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. +coyoteRequest.deletePartFailed=Failed to deleted temporary file used for part [{0}] coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}] coyoteRequest.getInputStream.ise=getReader() has already been called for this request diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index cc9a515f96..aa67ec5df5 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -443,8 +443,9 @@ public class Request implements HttpServletRequest { for (Part part : parts) { try { part.delete(); -} catch (IOException ignored) { -// ApplicationPart.delete() never throws an IOEx +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); +log.warn(sm.getString("coyoteRequest.deletePartFailed", part.getName()), t); } } parts = null; @@ -498,8 +499,8 @@ public class Request implements HttpServletRequest { asyncSupported = null; if (asyncContext != null) { asyncContext.recycle(); +asyncContext = null; } -asyncContext = null; } diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index 14f0855b9e..11779d364f 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -44,6 +44,7 @@ import org.apache.catalina.Session; import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.URLEncoder; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.Parameters; @@ -600,7 +601,12 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { */ public void recycle() { if (session != null) { -session.endAccess(); +try { +session.endAccess(); +} catch (Throwable t) { +ExceptionUtils.handleThrowable(t); + context.getLogger().warn(sm.getString("applicationHttpRequest.sessionEndAccessFail"), t); +} } } diff --git a/java/org/apache/catalina/core/LocalStrings.properties