Skip to content

Commit d6db22e

Browse files
committed
Improve handling of failures during recycle() methods
1 parent eb5c094 commit d6db22e

14 files changed

+52
-6
lines changed

java/org/apache/catalina/connector/LocalStrings.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener
5050
coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed
5151
coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request.
5252
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.
53+
coyoteRequest.deletePartFailed=Failed to deleted temporary file used for part [{0}]
5354
coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing
5455
coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}]
5556
coyoteRequest.getInputStream.ise=getReader() has already been called for this request

java/org/apache/catalina/connector/Request.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,9 @@ public void recycle() {
443443
for (Part part : parts) {
444444
try {
445445
part.delete();
446-
} catch (IOException ignored) {
447-
// ApplicationPart.delete() never throws an IOEx
446+
} catch (Throwable t) {
447+
ExceptionUtils.handleThrowable(t);
448+
log.warn(sm.getString("coyoteRequest.deletePartFailed", part.getName()), t);
448449
}
449450
}
450451
parts = null;
@@ -498,8 +499,8 @@ public void recycle() {
498499
asyncSupported = null;
499500
if (asyncContext != null) {
500501
asyncContext.recycle();
502+
asyncContext = null;
501503
}
502-
asyncContext = null;
503504
}
504505

505506

java/org/apache/catalina/core/ApplicationHttpRequest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.apache.catalina.util.ParameterMap;
4545
import org.apache.catalina.util.RequestUtil;
4646
import org.apache.catalina.util.URLEncoder;
47+
import org.apache.tomcat.util.ExceptionUtils;
4748
import org.apache.tomcat.util.buf.B2CConverter;
4849
import org.apache.tomcat.util.buf.MessageBytes;
4950
import org.apache.tomcat.util.http.Parameters;
@@ -600,7 +601,12 @@ public boolean isRequestedSessionIdValid() {
600601
*/
601602
public void recycle() {
602603
if (session != null) {
603-
session.endAccess();
604+
try {
605+
session.endAccess();
606+
} catch (Throwable t) {
607+
ExceptionUtils.handleThrowable(t);
608+
context.getLogger().warn(sm.getString("applicationHttpRequest.sessionEndAccessFail"), t);
609+
}
604610
}
605611
}
606612

java/org/apache/catalina/core/LocalStrings.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ applicationFilterRegistration.nullInitParam=Unable to set initialisation paramet
5959
applicationFilterRegistration.nullInitParams=Unable to set initialisation parameters for filter due to null name and/or value. Name [{0}], Value [{1}]
6060

6161
applicationHttpRequest.fragmentInDispatchPath=The fragment in dispatch path [{0}] has been removed
62+
applicationHttpRequest.sessionEndAccessFail=Exception triggered ending access to session while recycling request
6263

6364
applicationServletRegistration.setServletSecurity.iae=Null constraint specified for servlet [{0}] deployed to context with name [{1}]
6465
applicationServletRegistration.setServletSecurity.ise=Security constraints can''t be added to servlet [{0}] deployed to context with name [{1}] as the context has already been initialised

java/org/apache/catalina/core/LocalStrings_cs.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ applicationDispatcher.specViolation.response=Původní ServletResponse nebo zapo
2424

2525
applicationFilterRegistration.nullInitParams=Není možné nastavit inicializační parametry pro filtr kvůli hodnotě null ve jménu či hodnotě. Jméno [{0}], Hodnota [{1}]
2626

27+
applicationHttpRequest.sessionEndAccessFail=Výjimka vyvolala ukončení přístupu k session během recykllování dotazu
28+
2729
aprListener.initializingFIPS=Inicializace FIPS módu...
2830

2931
containerBase.backgroundProcess.cluster=Výjimka při zpracování procesu na pozadí v clusteru [{0}]

java/org/apache/catalina/core/LocalStrings_es.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ applicationFilterConfig.jmxUnregisterFail=Ha fallado el desregistro JMX para el
5252
applicationFilterRegistration.nullInitParam=No puedo poner el parámetro de inicialización para el filtro debido a un nombre nulo y/o valor. Nombre [{0}], Valor [{1}]
5353
applicationFilterRegistration.nullInitParams=No puedo poner los parámetros de inicialización para el filtro debido a un nombre nulo y/o valor. Nombre [{0}], Valor [{1}]
5454

55+
applicationHttpRequest.sessionEndAccessFail=Excepción disparada acabando acceso a sesión mientras se reciclaba el requerimiento
56+
5557
applicationServletRegistration.setServletSecurity.iae=Se ha especificado restricción Null para el servlet [{0}] desplegado en el contexto con el nombre [{1}]
5658
applicationServletRegistration.setServletSecurity.ise=No se pueden añadir restricciones de seguridad al servlet [{0}] desplegado en el contexto con el nombre [{1}] ya que el contexto ya ha sido inicializado.
5759

java/org/apache/catalina/core/LocalStrings_fr.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ applicationFilterRegistration.nullInitParam=Impossible de fixer le paramètre d'
5959
applicationFilterRegistration.nullInitParams=Impossible de fixer les paramètres d''initialisation du filtre, à cause d''un nom ou d''une valeur nulle, nom [{0}], valeur [{1}]
6060

6161
applicationHttpRequest.fragmentInDispatchPath=Le fragment dans le chemin de dispatch [{0}] a été enlevé
62+
applicationHttpRequest.sessionEndAccessFail=Exception lancée durant l'arrêt de l'accès à la session durant le recyclage de la requête
6263

6364
applicationServletRegistration.setServletSecurity.iae=Contrainte nulle spécifiée pour le Servlet [{0}] déployé dans le contexte avec le nom [{1}]
6465
applicationServletRegistration.setServletSecurity.ise=Les contraintes de sécurité ne peuvent pas être ajoutées au Servlet [{0}] déployé dans le contexte [{1}] car le contexte a déjà été initialisé

java/org/apache/catalina/core/LocalStrings_ja.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ applicationFilterRegistration.nullInitParam=NULLの名前や値のためにフ
5959
applicationFilterRegistration.nullInitParams=キー [{0}] または値 [{1}] のいずれかが null のためフィルターの初期化パラメータを設定できません。
6060

6161
applicationHttpRequest.fragmentInDispatchPath=ディスパッチパス [{0}] 中のフラグメントは除去されました
62+
applicationHttpRequest.sessionEndAccessFail=リクエストの再利用中に行ったセッションへのアクセス終了処理で例外が送出されました。
6263

6364
applicationServletRegistration.setServletSecurity.iae=サーブレット [{0}] に指定されたNULL制約が、名前 [{1}] のコンテキストに配備されました
6465
applicationServletRegistration.setServletSecurity.ise=コンテキストが既に初期化されているため、名前 [{1}] のコンテキストに配備されたサーブレット [{0}] にセキュリティ制約を追加できません

java/org/apache/catalina/core/LocalStrings_ko.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ applicationFilterRegistration.nullInitParam=이름 또는 값 또는 둘 다 널
5959
applicationFilterRegistration.nullInitParams=널인 이름 또는 값 때문에, 필터의 초기화 파라미터를 설정할 수 없습니다. 이름: [{0}], 값: [{1}]
6060

6161
applicationHttpRequest.fragmentInDispatchPath=디스패치 경로 [{0}](으)로부터 URI fragment를 제거했습니다.
62+
applicationHttpRequest.sessionEndAccessFail=요청을 참조 해제하는 과정에서, 세션에 대한 접근을 종료시키려 개시하는 중 예외 발생
6263

6364
applicationServletRegistration.setServletSecurity.iae=[{1}](이)라는 이름의 컨텍스트에 배치된 서블릿 [{0}]을(를) 위해, 널 constraint가 지정되었습니다.
6465
applicationServletRegistration.setServletSecurity.ise=컨텍스트가 이미 초기화되었기에, [{1}](이)라는 이름의 컨텍스트에 배치된 서블릿 [{0}]에 security constraint들이 추가될 수 없습니다.

java/org/apache/catalina/core/LocalStrings_zh_CN.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ applicationFilterRegistration.nullInitParam=由于名称和/或值为空,无
6060
applicationFilterRegistration.nullInitParams=由于name和(或)value为null,无法为过滤器设置初始化参数。name为 [{0}],value为 [{1}]
6161

6262
applicationHttpRequest.fragmentInDispatchPath=调度路径[{0}]中的片段已被删除
63+
applicationHttpRequest.sessionEndAccessFail=在回收请求时,异常触发了对会话的结束访问。
6364

6465
applicationServletRegistration.setServletSecurity.iae=为部署到名为[{1}]的上下文的Servlet[{0}]指定的空约束
6566
applicationServletRegistration.setServletSecurity.ise=无法将安全性约束添加到已部署到名称为[{1}]的上下文的servlet [{0}]中,因为上下文已被初始化

0 commit comments

Comments
 (0)