You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/01/20 19:34:19 UTC

svn commit: r1061442 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Request.java

Author: markt
Date: Thu Jan 20 18:34:18 2011
New Revision: 1061442

URL: http://svn.apache.org/viewvc?rev=1061442&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

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/connector/Request.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1061442&r1=1061441&r2=1061442&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Thu Jan 20 18:34:18 2011
@@ -64,6 +64,7 @@ coyoteRequest.alreadyAuthenticated=This 
 coyoteRequest.noLoginConfig=No authentication mechanism has been configured for this context
 coyoteRequest.authenticate.ise=Cannot call authenticate() after the reponse has been committed
 coyoteRequest.uploadLocationInvalid=The temporary upload location [{0}] is not valid
+coyoteRequest.sessionEndAccessFail=Exception triggered ending access to session while recycling request
 
 requestFacade.nullRequest=The request object has been recycled and is no longer associated with this facade
 

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1061442&r1=1061441&r2=1061442&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Jan 20 18:34:18 2011
@@ -75,6 +75,8 @@ import org.apache.catalina.util.Enumerat
 import org.apache.catalina.util.ParameterMap;
 import org.apache.catalina.util.StringParser;
 import org.apache.coyote.ActionCode;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.buf.B2CConverter;
 import org.apache.tomcat.util.buf.ByteChunk;
@@ -105,7 +107,8 @@ import org.apache.tomcat.util.res.String
 public class Request
     implements HttpServletRequest {
 
-
+    private static final Log log = LogFactory.getLog(Connector.class);
+    
     // ----------------------------------------------------------- Constructors
 
 
@@ -492,7 +495,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;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1061442 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Request.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/21 Mark Thomas <ma...@apache.org>:
>> How can endAccess throw an exception ?
>
> I asked myself exactly the same question when I read the bug report. My
> conclusion was:
> - StandardSession - it can't unless there is a bug
> - DeltaSession - it can't unless there is a bug
> - Custom session implementation - who knows
>
> It seemed reasonable to add the protection for the custom case
>

StandardSession  -- can StandardSession#accessCount be null? This
field is declared transient.

ReplicatedSession = StandardSession (does not override the method)

DeltaSession -- DeltaManager#registerSessionAtReplicationValve() call
there is not trivial, though I do not see evident issues there. May be
the following:
in ReplicationValve# registerReplicationSession() has the following code:

                if(log.isDebugEnabled())

log.debug(sm.getString("ReplicationValve.crossContext.registerSession",
                        session.getIdInternal(),
                        session.getManager().getContainer().getName()));

If debug logging is enabled and session.recycle() was already called,
session.getManager() will return null.


Anyway as
  a) custom components can be involved there
  b) endAccess() is not a trivial method to be used in recycle()
it would be better to safeguard it.


Backporting the fix to 5.5 waits for the third vote.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1061442 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Request.java

Posted by Mark Thomas <ma...@apache.org>.
On 21/01/2011 09:39, Remy Maucherat wrote:
> On Thu, 2011-01-20 at 18:34 +0000, markt@apache.org wrote:
>> Author: markt
>> Date: Thu Jan 20 18:34:18 2011
>> New Revision: 1061442
>>
>> URL: http://svn.apache.org/viewvc?rev=1061442&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
> 
> How can endAccess throw an exception ?

I asked myself exactly the same question when I read the bug report. My
conclusion was:
- StandardSession - it can't unless there is a bug
- DeltaSession - it can't unless there is a bug
- Custom session implementation - who knows

It seemed reasonable to add the protection for the custom case

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1061442 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Request.java

Posted by Remy Maucherat <re...@apache.org>.
On Thu, 2011-01-20 at 18:34 +0000, markt@apache.org wrote:
> Author: markt
> Date: Thu Jan 20 18:34:18 2011
> New Revision: 1061442
> 
> URL: http://svn.apache.org/viewvc?rev=1061442&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

How can endAccess throw an exception ?

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1061442 - in /tomcat/trunk/java/org/apache/catalina/connector: LocalStrings.properties Request.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/20  <ma...@apache.org>:
> Author: markt
> Date: Thu Jan 20 18:34:18 2011
> New Revision: 1061442
>
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
>    tomcat/trunk/java/org/apache/catalina/connector/Request.java
>
> --- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Jan 20 18:34:18 2011
> @@ -105,7 +107,8 @@ import org.apache.tomcat.util.res.String
>  public class Request
>     implements HttpServletRequest {
>
> -
> +    private static final Log log = LogFactory.getLog(Connector.class);
> +
Should be getLog(Request.class);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org