[ 
https://issues.apache.org/jira/browse/OPENJPA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517291
 ] 

Michael Dick commented on OPENJPA-295:
--------------------------------------

Getting back to Marc's comment. I think the difference in this case is that 
WebSphere Application Server (and I'm guessing Geronimo) use the 
TransactionSynchronizationRegistry. 

When we use the TSR to get a TransactionManager it returns a 
TransactionManagerFacade (a singleton), calling getTransaction() on the facade 
returns a singleton (itself) as well. If I haven't misread the code, we'll hit 
this problem fairly quickly with any Application Server that uses the TSR.

I can think of two potential fixes (assuming I've identified the problem 
correctly) : 

1. Use a concurrent set (similar to the patch I attached earlier). 

2. The TSR API provides a getTransactionKey() method. The 
TransactionManagerFacade could be modified to return a new "TransactionFacade" 
Object when getTransaction is called. The TransactionFacade could use the 
transactionKey's hashcode (which should be unique to each transaction), and 
we'll avoid the collision. 

Does anyone see a problem with either approach (or something I've missed) ? 


> ArrayIndexOutofBoundsException when under load and within a managed 
> Transaction
> -------------------------------------------------------------------------------
>
>                 Key: OPENJPA-295
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-295
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.0.0
>         Environment: openjpa running under WebSphere development builds, as 
> well as Geronimo development builds
>            Reporter: Rob Wisniewski
>            Priority: Blocker
>         Attachments: OPENJPA-295.diff.txt
>
>
> Recent development builds of our WAS products as well as the Geronimo project 
> are seeing exceptions when running under load.  An example of the exception 
> is below:
> Caused by: 
> java.lang.ArrayIndexOutOfBoundsException
>       at java.util.ArrayList.add(ArrayList.java:378)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:684)
>       ... 39 more
> This is the deepest trace I can get with the actual exception, but the 
> wrappering exception shows this stack trace for geronimo:
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal general error> 
> org.apache.openjpa.persistence.PersistenceException: null
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:690)
>       at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:304)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:182)
>       at 
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:190)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:55)
>       at 
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createEntityManager(CMPEntityManagerTxScoped.java:74)
>       at 
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.getEntityManager(CMPEntityManagerTxScoped.java:55)
>       at 
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createNamedQuery(CMPEntityManagerTxScoped.java:259)
>       at 
> org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBBean.getClosedOrders(TradeSLSBBean.java:335)
> This is happening in two separate products with two different JTA 
> implementations, and also both of these products were working at one point.
> Any ideas?

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

Reply via email to