geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald Woods (JIRA)" <j...@apache.org>
Subject [jira] Updated: (GERONIMO-3363) ArrayList thread safe problem in OpenJPA
Date Mon, 30 Jul 2007 13:29:20 GMT

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

Donald Woods updated GERONIMO-3363:
-----------------------------------

         Priority: Blocker  (was: Major)
    Fix Version/s:     (was: 2.0-M7)
                   2.0

> ArrayList thread safe problem in OpenJPA
> ----------------------------------------
>
>                 Key: GERONIMO-3363
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3363
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: persistence
>    Affects Versions: 2.0-M7
>            Reporter: YunFeng Ma
>            Priority: Blocker
>             Fix For: 2.0
>
>
> When running stress testing using DayTrader with JPA mode, got a lot of ArrayList thread
safe problem.
> The thread safe problem happened in  org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction,
but this method has the following comments:
>             // we don't need to synchronize on brokers or guard against multiple
>             // threads using the same trans since one JTA transaction can never
>             // be active on multiple concurrent threads.
>             Collection brokers = (Collection) _transactional.get(trans);
>             if (brokers == null) {
>                 brokers = new ArrayList(2);
>                 _transactional.put(trans, brokers);
>                 trans.registerSynchronization(new RemoveTransactionSync(trans));
>             }
>             brokers.add(broker);
> Does this mean that it's Geronimo which causes the thread safe problem?
> The exception stack:
> java.rmi.RemoteException: The bean encountered a non-application exception.; nested exception
is:
>         javax.ejb.EJBException: TradeBean.getClosedOrders - error
>         at org.apache.openejb.core.transaction.TransactionPolicy.throwExceptionToServer(TransactionPolicy.java:211)
>         at org.apache.openejb.core.transaction.TxRequired.handleSystemException(TxRequired.java:106)
>         at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:210)
>         at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
>         at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:211)
>         at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:65)
>         at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:232)
>         at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
>         at $Proxy109.getClosedOrders(Unknown Source)
>         at org.apache.geronimo.samples.daytrader.TradeAction.getClosedOrders(TradeAction.java:276)
>         at org.apache.geronimo.samples.daytrader.web.OrdersAlertFilter.doFilter(OrdersAlertFilter.java:76)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>         at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
>         at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:351)
>         at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
>         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
>         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>         at java.lang.Thread.run(Thread.java:801)
> Caused by: javax.ejb.EJBException: TradeBean.getClosedOrders - error
>         at org.apache.geronimo.samples.daytrader.TradeJPA.getClosedOrders(TradeJPA.java:491)
>         at sun.reflect.GeneratedMethodAccessor324.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:615)
>         at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
> .java:146)
>         at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
>         at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
>         at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:203)
>         ... 24 more
> Caused by: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
null
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:738)
>         at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:305)
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:186)
>         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.TradeJPA.getClosedOrders(TradeJPA.java:470)
>         ... 31 more
> Caused by: java.lang.Exception: java.lang.ArrayIndexOutOfBoundsException
>         at org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:242)
>         at org.apache.openjpa.persistence.PersistenceException.writeObject(PersistenceException.java:100)
>         at sun.reflect.GeneratedMethodAccessor344.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:615)
>         at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:972)
>         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1426)
>         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1377)
>         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
>         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1462)
>         at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413)
>         at java.lang.Throwable.writeObject(Throwable.java:320)
>         at sun.reflect.GeneratedMethodAccessor341.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:615)
>         at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:972)
>         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1426)
>         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1377)
>         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
>         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1462)
>         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1434)
>         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1377)
>         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
>         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:324)
>         at org.apache.openejb.core.ivm.BaseEjbProxyHandler.copyObj(BaseEjbProxyHandler.java:491)
>         at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:237)
>         ... 20 more
> 20:00:40,656 ERROR [OpenEJB] The bean instances business method encountered a system
exception: null
> <1.0.0-SNAPSHOT-SNAPSHOT nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
null
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:738)
>         at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:305)
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:186)
>         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.find(CMPEntityManagerTxScoped.java:123)
>         at org.apache.geronimo.samples.daytrader.TradeJPA.getQuote(TradeJPA.java:201)
>         at sun.reflect.GeneratedMethodAccessor330.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:615)
>         at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext
> .java:146)
>         at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
>         at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
>         at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:203)
>         at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
>         at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:211)
>         at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:65)
>         at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:232)
>         at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
>         at $Proxy109.getQuote(Unknown Source)
>         at org.apache.geronimo.samples.daytrader.TradeAction.getQuote(TradeAction.java:328)
>         at org.apache.geronimo.samples.daytrader.web.TradeServletAction.doPortfolio(TradeServletAction.java:518)
>         at org.apache.geronimo.samples.daytrader.web.TradeAppServlet.performTask(TradeAppServlet.java:165)
>         at org.apache.geronimo.samples.daytrader.web.TradeAppServlet.doGet(TradeAppServlet.java:77)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at org.apache.geronimo.samples.daytrader.web.OrdersAlertFilter.doFilter(OrdersAlertFilter.java:91)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>         at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
>         at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:351)
>         at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
>         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
>         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>         at java.lang.Thread.run(Thread.java:801)
> Caused by:
> java.lang.ArrayIndexOutOfBoundsException
>         at java.util.ArrayList.add(ArrayList.java:378)
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTransaction(AbstractBrokerFactory.java:732)
>         ... 47 more
> The problem can be easy fixed by changing the following line:
>         brokers = new ArrayList(2); --> brokers = Collections.synchronizedCollection(new
ArrayList(2));
> But not sure it's whose problem.

-- 
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