activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phillip Henry (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AMQ-2249) The pool is not being informed that invalid PooledSessions are being thrown away
Date Wed, 13 May 2009 13:54:51 GMT

     [ https://issues.apache.org/activemq/browse/AMQ-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Phillip Henry updated AMQ-2249:
-------------------------------

    Description: 
PooledConnection.close() calls rollback() on the internal session. However, when the internal
session is an instance of  ActiveMQXASession, this always results in a TransactionInProgressException
being thrown (and subsequently caught). Unfortunately, in this path of execution, the session
pool is not informed.

The sessionPool knows nothing about the session being discarded and ultimately, GenericObjectPool.borrowObject()
blocks forever since _numActive is never decremented.

I think the pool should at least be told that the session has been invalidated (this is not
a full fix but should at least stop any hanging threads). Below is a partial patch (I'll work
on a full solution when I have time):
{code} 
Index: activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java
===================================================================
--- activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (revision
768326)
+++ activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (working copy)
@@ -120,6 +120,7 @@
                         LOG.trace("Ignoring exception as discarding session: " + e1, e1);
                     }
                     session = null;
+                    sessionPool.invalidateSession(this);
                     return;
                 }
             }
Index: activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java
===================================================================
--- activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (revision
768326)
+++ activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (working copy)
@@ -59,6 +59,14 @@
             throw JMSExceptionSupport.create(e);
         }
     }
+    
+    public void invalidateSession(PooledSession session) throws JMSException {
+       try {
+            getSessionPool().invalidateObject(session);
+        } catch (Exception e) {
+            throw JMSExceptionSupport.create("Failed to invalidate session: " + e, e);
+        }
+    }
 
     public void returnSession(PooledSession session) throws JMSException {
         // lets check if we are already closed
{code} 

  was:
PooledConnection.close() calls rollback() on the internal session. However, when the internal
session is an instance of  ActiveMQXASession, this always results in a TransactionInProgressException
being thrown (and subsequently caught). Unfortunately, in this path of execution, the session
pool is not informed.

The sessionPool knows nothing about the session being discarded and ultimately, GenericObjectPool.borrowObject()
blocks forever since _numActive is never decremented.

I think the pool should at least be told that the session has been invalidated (this is not
a full fix but should at least stop any hanging threads). Below is a partial patch (I'll work
on a full solution when I have time):

Index: activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java
===================================================================
--- activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (revision
768326)
+++ activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (working copy)
@@ -120,6 +120,7 @@
                         LOG.trace("Ignoring exception as discarding session: " + e1, e1);
                     }
                     session = null;
+                    sessionPool.invalidateSession(this);
                     return;
                 }
             }
Index: activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java
===================================================================
--- activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (revision
768326)
+++ activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (working copy)
@@ -59,6 +59,14 @@
             throw JMSExceptionSupport.create(e);
         }
     }
+    
+    public void invalidateSession(PooledSession session) throws JMSException {
+       try {
+            getSessionPool().invalidateObject(session);
+        } catch (Exception e) {
+            throw JMSExceptionSupport.create("Failed to invalidate session: " + e, e);
+        }
+    }
 
     public void returnSession(PooledSession session) throws JMSException {
         // lets check if we are already closed


> The pool is not being informed that invalid PooledSessions are being thrown away
> --------------------------------------------------------------------------------
>
>                 Key: AMQ-2249
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2249
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.2.0
>         Environment: Windows XP using ActiveMQ in conjunction with Jencks, Spring and
JOTM.
>            Reporter: Phillip Henry
>
> PooledConnection.close() calls rollback() on the internal session. However, when the
internal session is an instance of  ActiveMQXASession, this always results in a TransactionInProgressException
being thrown (and subsequently caught). Unfortunately, in this path of execution, the session
pool is not informed.
> The sessionPool knows nothing about the session being discarded and ultimately, GenericObjectPool.borrowObject()
blocks forever since _numActive is never decremented.
> I think the pool should at least be told that the session has been invalidated (this
is not a full fix but should at least stop any hanging threads). Below is a partial patch
(I'll work on a full solution when I have time):
> {code} 
> Index: activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java
> ===================================================================
> --- activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (revision
768326)
> +++ activemq-pool/src/main/java/org/apache/activemq/pool/PooledSession.java     (working
copy)
> @@ -120,6 +120,7 @@
>                          LOG.trace("Ignoring exception as discarding session: " + e1,
e1);
>                      }
>                      session = null;
> +                    sessionPool.invalidateSession(this);
>                      return;
>                  }
>              }
> Index: activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java
> ===================================================================
> --- activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (revision
768326)
> +++ activemq-pool/src/main/java/org/apache/activemq/pool/SessionPool.java       (working
copy)
> @@ -59,6 +59,14 @@
>              throw JMSExceptionSupport.create(e);
>          }
>      }
> +    
> +    public void invalidateSession(PooledSession session) throws JMSException {
> +       try {
> +            getSessionPool().invalidateObject(session);
> +        } catch (Exception e) {
> +            throw JMSExceptionSupport.create("Failed to invalidate session: " + e, e);
> +        }
> +    }
>  
>      public void returnSession(PooledSession session) throws JMSException {
>          // lets check if we are already closed
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message