Christian Müller created CAMEL-6857:
---------------------------------------
Summary: camel-jpa is throwing an exception in high concurrency
Key: CAMEL-6857
URL: https://issues.apache.org/jira/browse/CAMEL-6857
Project: Camel
Issue Type: Bug
Components: camel-jpa
Affects Versions: 2.12.1, 2.11.2
Reporter: Christian Müller
Fix For: 2.11.3, 2.12.2, 2.13.0
Today, it looks much better [1]. We are trying to fix the unit tests which are
failing from time to time on slower boxes. But this isn't so easy for all of
them...
I had a look at
org.apache.camel.processor.jpa.JpaProducerConcurrentTest.testConcurrentProducers.
A few times I get the following exception which results in missing exchanges
in the mock:result endpoint:
{noformat}
2013-10-11 14:01:10,623 [pool-2-thread-2] ERROR DefaultErrorHandler
- Failed delivery for (MessageId:
ID-christians-macbook-pro-fritz-box-54975-1381492869188-0-4 on ExchangeId:
ID-christians-macbook-pro-fritz-box-54975-1381492869188-0-9). Exhausted after
delivery attempt: 1 caught:
org.springframework.dao.InvalidDataAccessApiUsageException: This operation
cannot be performed while a Transaction is active.; nested exception is
<openjpa-2.2.2-r422266:1468616 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException: This operation cannot be
performed while a Transaction is active.
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor
Elapsed (ms)
[route1 ] [route1 ] [direct://start
] [ 68]
[route1 ] [to1 ]
[jpa://org.apache.camel.examples.SendEmail
] [ 67]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id
ID-christians-macbook-pro-fritz-box-54975-1381492869188-0-9
ExchangePattern InOnly
Headers
{breadcrumbId=ID-christians-macbook-pro-fritz-box-54975-1381492869188-0-4,
CamelEntityManager=org.apache.openjpa.persistence.EntityManagerImpl@6e453dd5,
CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType org.apache.camel.examples.SendEmail
Body SendEmail[id: 102 address: null]
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.springframework.dao.InvalidDataAccessApiUsageException: This operation
cannot be performed while a Transaction is active.; nested exception is
<openjpa-2.2.2-r422266:1468616 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException: This operation cannot be
performed while a Transaction is active.
at
org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:293)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.convertException(ExtendedEntityManagerCreator.java:501)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerSynchronization.afterCommit(ExtendedEntityManagerCreator.java:482)
at
org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)
at
org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:951)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:797)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:148)
at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:53)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:132)
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:127)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:56)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73)
at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378)
at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:1)
at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242)
at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346)
at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:184)
at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:124)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:137)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:144)
at
org.apache.camel.processor.jpa.JpaProducerConcurrentTest$1.call(JpaProducerConcurrentTest.java:58)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: <openjpa-2.2.2-r422266:1468616 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException: This operation cannot be
performed while a Transaction is active.
at org.apache.openjpa.kernel.BrokerImpl.begin(BrokerImpl.java:1369)
at
org.apache.openjpa.kernel.DelegatingBroker.begin(DelegatingBroker.java:925)
at
org.apache.openjpa.persistence.EntityManagerImpl.begin(EntityManagerImpl.java:565)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.enlistInCurrentTransaction(ExtendedEntityManagerCreator.java:422)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.doJoinTransaction(ExtendedEntityManagerCreator.java:399)
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:351)
at com.sun.proxy.$Proxy18.joinTransaction(Unknown Source)
at
org.apache.camel.component.jpa.JpaProducer$1.doInTransaction(JpaProducer.java:55)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
... 27 more
{noformat}
which is throwing from the line 55 in org.apache.camel.component.jpa.JpaProducer
entityManager.joinTransaction();
I think this is a concurrency issue we have to investigate (not sure whether
the issue is in Camel, Spring, OpenJPA, ...).
--
This message was sent by Atlassian JIRA
(v6.1#6144)