ConcurrentModificationException from SinglePoolMatchAllConnectionInterceptor

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ConcurrentModificationException from SinglePoolMatchAllConnectionInterceptor

sjunejo
Hi,

I am using Jencks 2.2 with geronimo-connector 2.1.2 implementation. I am using this with custom JCA RA implementation and recently when I started this in a heavily used multi threaded environment I am getting following exception;

java.util.ConcurrentModificationException
        at java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(IdentityHashMap.java:732)
        at java.util.IdentityHashMap$KeyIterator.next(IdentityHashMap.java:822)
        at com.jbase.jremote.jca.JRemoteManagedConnectionFactory.matchManagedConnections(Unknown Source)
        at org.apache.geronimo.connector.outbound.SinglePoolMatchAllConnectionInterceptor.internalGetConnection(SinglePoolMatchAllConnectionInterceptor.java:61)
        at org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
        at org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:46)
        at org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:96)
        at org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)
        at org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
        at org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:87)
        at com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown Source)
        at com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown Source)

I looked at the source but as far as I can see we are using IdentityHashMap but we do synchronize(pool) just before calling the matchManagedConnections method on my connection factory.

Does anyone in the mailing encounter this....how can I solve this?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: ConcurrentModificationException from SinglePoolMatchAllConnectionInterceptor

gary
Do you do any customize action in SinglePoolMatchAllConnectionInterceptor.internalGetConnection?
It looks like connection pool size has been updated. Suggest to double check your multi thread implementation. For example, debug to track the change of pool size.

2015-10-28 15:21 GMT+08:00 sjunejo <[hidden email]>:
Hi,

I am using Jencks 2.2 with geronimo-connector 2.1.2 implementation. I am
using this with custom JCA RA implementation and recently when I started
this in a heavily used multi threaded environment I am getting following
exception;

java.util.ConcurrentModificationException
        at
java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(IdentityHashMap.java:732)
        at
java.util.IdentityHashMap$KeyIterator.next(IdentityHashMap.java:822)
        at
com.jbase.jremote.jca.JRemoteManagedConnectionFactory.matchManagedConnections(Unknown
Source)
        at
org.apache.geronimo.connector.outbound.SinglePoolMatchAllConnectionInterceptor.internalGetConnection(SinglePoolMatchAllConnectionInterceptor.java:61)
        at
org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
        at
org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:46)
        at
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:96)
        at
org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)
        at
org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
        at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:87)
        at
com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown
Source)
        at
com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown
Source)

I looked at the source but as far as I can see we are using IdentityHashMap
but we do synchronize(pool) just before calling the matchManagedConnections
method on my connection factory.

Does anyone in the mailing encounter this....how can I solve this?

Regards



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/ConcurrentModificationException-from-SinglePoolMatchAllConnectionInterceptor-tp3989671.html
Sent from the Users mailing list archive at Nabble.com.



--
Best Regards
Gary
Reply | Threaded
Open this post in threaded view
|

Re: ConcurrentModificationException from SinglePoolMatchAllConnectionInterceptor

sjunejo
This post has NOT been accepted by the mailing list yet.

No I am using standard implementation with Jencks 2.2. Which uses Geronimo 2.1.2.

I looked at the code at GrepCode and found that in SinglePoolMatchAllConnectionInterceptor class using synchronize(pool) everywhere but doAdd() and doRemove() methods of its implementation....not sure why we are not using synchronize there. If we add it there than until  matchManagedConnection() is done no one would be able to alter the pool.

Or simply switch to use ConcurrentHashMap implementation instead of IdentityHashmap for pool?

I am using this in a single thread ConnectionManager with single threaded ConnectionFactory but still getting this....not sure what is the problem....

On 3 Nov 2015 08:22, "gary [via Apache Geronimo]" <[hidden email]> wrote:
Do you do any customize action in SinglePoolMatchAllConnectionInterceptor.internalGetConnection?
It looks like connection pool size has been updated. Suggest to double check your multi thread implementation. For example, debug to track the change of pool size.

2015-10-28 15:21 GMT+08:00 sjunejo <[hidden email]>:
Hi,

I am using Jencks 2.2 with geronimo-connector 2.1.2 implementation. I am
using this with custom JCA RA implementation and recently when I started
this in a heavily used multi threaded environment I am getting following
exception;

java.util.ConcurrentModificationException
        at
java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(IdentityHashMap.java:732)
        at
java.util.IdentityHashMap$KeyIterator.next(IdentityHashMap.java:822)
        at
com.jbase.jremote.jca.JRemoteManagedConnectionFactory.matchManagedConnections(Unknown
Source)
        at
org.apache.geronimo.connector.outbound.SinglePoolMatchAllConnectionInterceptor.internalGetConnection(SinglePoolMatchAllConnectionInterceptor.java:61)
        at
org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
        at
org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:46)
        at
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:96)
        at
org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)
        at
org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
        at
org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:87)
        at
com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown
Source)
        at
com.jbase.jremote.jca.JRemoteConnectionFactoryImpl.getConnection(Unknown
Source)

I looked at the source but as far as I can see we are using IdentityHashMap
but we do synchronize(pool) just before calling the matchManagedConnections
method on my connection factory.

Does anyone in the mailing encounter this....how can I solve this?

Regards



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/ConcurrentModificationException-from-SinglePoolMatchAllConnectionInterceptor-tp3989671.html
Sent from the Users mailing list archive at Nabble.com.



--
Best Regards
Gary



To unsubscribe from ConcurrentModificationException from SinglePoolMatchAllConnectionInterceptor, click here.
NAML