Author: kkolinko Date: Thu Feb 3 21:54:51 2011 New Revision: 1066996 URL: http://svn.apache.org/viewvc?rev=1066996&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50620 Exceptions calling session.endAccess should not prevent recycle() from completing normally
Added: tomcat/tc5.5.x/trunk/connectors/util/java/org/apache/tomcat/util/ExceptionUtils.java Modified: tomcat/tc5.5.x/trunk/STATUS.txt tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/Request.java tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Modified: tomcat/tc5.5.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1066996&r1=1066995&r2=1066996&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/STATUS.txt (original) +++ tomcat/tc5.5.x/trunk/STATUS.txt Thu Feb 3 21:54:51 2011 @@ -41,21 +41,6 @@ PATCHES PROPOSED TO BACKPORT: -O: jim -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50620 - Exceptions calling session.endAccess should not prevent recycle() from completing normally - 1) copy o.a.tomcat.util.ExceptionUtils from trunk - svn copy ../../trunk/java/org/apache/tomcat/util/ExceptionUtils.java connectors/util/java/org/apache/tomcat/util/ - 2) patches: - http://svn.apache.org/viewvc?rev=1061442&view=rev - http://svn.apache.org/viewvc?rev=1061446&view=rev - (by markt) - +1: kkolinko, markt, rjung - -1: - - (For convenience, here is patch that applies the above: - http://people.apache.org/~kkolinko/patches/2011-01-22_tc55_50620.patch - ) - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50325 Use JVM provided solutions to CVE-2009-3555 if available (i.e. RFC 5746 support) Added: tomcat/tc5.5.x/trunk/connectors/util/java/org/apache/tomcat/util/ExceptionUtils.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/connectors/util/java/org/apache/tomcat/util/ExceptionUtils.java?rev=1066996&view=auto ============================================================================== --- tomcat/tc5.5.x/trunk/connectors/util/java/org/apache/tomcat/util/ExceptionUtils.java (added) +++ tomcat/tc5.5.x/trunk/connectors/util/java/org/apache/tomcat/util/ExceptionUtils.java Thu Feb 3 21:54:51 2011 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.util; + +/** + * Utilities for handling Throwables and Exceptions. + */ +public class ExceptionUtils { + + /** + * Checks whether the supplied Throwable is one that needs to be + * rethrown and swallows all others. + * @param t the Throwable to check + */ + public static void handleThrowable(Throwable t) { + if (t instanceof ThreadDeath) { + throw (ThreadDeath) t; + } + if (t instanceof VirtualMachineError) { + throw (VirtualMachineError) t; + } + // All other instances of Throwable will be silently swallowed + } +} Modified: tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties?rev=1066996&r1=1066995&r2=1066996&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties (original) +++ tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties Thu Feb 3 21:54:51 2011 @@ -59,6 +59,7 @@ coyoteRequest.attributeEvent=Exception t coyoteRequest.parseParameters=Exception thrown whilst processing POSTed parameters coyoteRequest.postTooLarge=Parameters were not parsed because the size of the posted data was too big. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. 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.sessionEndAccessFail=Exception triggered ending access to session while recycling request requestFacade.nullRequest=Null request object responseFacade.nullResponse=Null response object Modified: tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/Request.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/Request.java?rev=1066996&r1=1066995&r2=1066996&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/Request.java (original) +++ tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/connector/Request.java Thu Feb 3 21:54:51 2011 @@ -45,6 +45,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.MessageBytes; @@ -55,6 +56,9 @@ import org.apache.tomcat.util.http.Param import org.apache.tomcat.util.http.ServerCookie; import org.apache.tomcat.util.http.mapper.MappingData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.apache.coyote.ActionCode; import org.apache.catalina.Context; @@ -86,6 +90,8 @@ public class Request private final static boolean ALLOW_EMPTY_QUERY_STRING; + private static final Log log = LogFactory.getLog(Request.class); + static { // Ensure that classes are loaded for SM new StringCache.ByteEntry(); @@ -407,7 +413,12 @@ public class Request cookies = null; if (session != null) { - session.endAccess(); + try { + session.endAccess(); + } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); + log.warn(sm.getString("coyoteRequest.sessionEndAccessFail"), t); + } } session = null; requestedSessionCookie = false; Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=1066996&r1=1066995&r2=1066996&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Thu Feb 3 21:54:51 2011 @@ -71,6 +71,11 @@ Improve HTTP specification compliance in support of <code>Accept-Language</code> header. (kkolinko) </fix> + <fix> + <bug>50620</bug>: Stop exceptions that occur during + <code>Session.endAccess()</code> from preventing the normal completion + of <code>Request.recycle()</code>. (markt/kkolinko) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org