Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ConcurrencyException throwed [SOLVED]
icon9.gif  ConcurrencyException throwed [SOLVED] [message #1749265] Sun, 04 December 2016 23:12 Go to next message
vrivon Mising name is currently offline vrivon Mising nameFriend
Messages: 8
Registered: March 2010
Junior Member
Hi:

We've been working on an application that uses Tomcat 8 throught connection pool. We control Optimistic exceptions with @Version field, and we control transactions with Entitymanagers isolated by ThreadLocal.

However, the application triggers a concurrency exception sometimes with hangs other processes and requieres to restart the server.

The exception is always like this:

Caused by: Exception [EclipseLink-2004] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ConcurrencyException
Exception Description: A signal was attempted before wait() on ConcurrencyManager. This normally means that an attempt was made to 
commit or rollback a transaction before it was started, or to rollback a transaction twice.
	at org.eclipse.persistence.exceptions.ConcurrencyException.signalAttemptedBeforeWait(ConcurrencyException.java:84)
	at org.eclipse.persistence.internal.helper.ConcurrencyManager.releaseReadLock(ConcurrencyManager.java:468)
	at org.eclipse.persistence.internal.identitymaps.CacheKey.releaseReadLock(CacheKey.java:475)


We've been trying to solve this problem or find any specific information about this error with no result. We even followed instructions in https://wiki.eclipse.org/EclipseLink/FAQ/JPA#How_to_diagnose_and_resolve_hangs_and_deadlocks.3F.

Disabling cache seems to solve the problem, but we cannt afford to not use cache due to performance needs.

Any help would be appreciated.
Thanks

[Updated on: Wed, 14 December 2016 11:07]

Report message to a moderator

Re: ConcurrencyException throwed [message #1749313 is a reply to message #1749265] Mon, 05 December 2016 11:37 Go to previous messageGo to next message
vrivon Mising name is currently offline vrivon Mising nameFriend
Messages: 8
Registered: March 2010
Junior Member
Error can be triggered either after getting IndirectSet / IndirectList data or using a namedQuery. I observed that method calls from the controller class are less likely to trigger the error than calls from .jsp files.
Re: ConcurrencyException throwed [message #1749511 is a reply to message #1749313] Wed, 07 December 2016 15:55 Go to previous messageGo to next message
vrivon Mising name is currently offline vrivon Mising nameFriend
Messages: 8
Registered: March 2010
Junior Member
I realised that I had some non fetch="LAZY" OneToMany collections. Adding that option solved part of the problem.

The second thing I realised is that quering from the JSP files using expresion language also can throw ConcurrencyException's, so I started moving querys to the java controller classes. It seemed to solve 99% of cases, but today I got an exception when a java class called "find" Sad
Re: ConcurrencyException throwed [message #1749953 is a reply to message #1749511] Wed, 14 December 2016 11:06 Go to previous message
vrivon Mising name is currently offline vrivon Mising nameFriend
Messages: 8
Registered: March 2010
Junior Member
Finally, after six months of headaches, I managed to solve the problem.

The general error was EclipseLink-2004. If you check Eclipselink error reference: Eclipse link error reference page, it says "Verify transactions in the application".

I've been using a application managed Entity Managers. To control that transactions were single-thread I used this ManagerHelper class:

EntityManagerHelper


The problem was that I was putting a managed object inside a Session attribute. I don't really understand the process inside, but somehow it created new transactions outside the main transaction if it was used to query. Moving the object to Request attributes solved the problem.

I hope this helps to someone in the future.

Best regards

Previous Topic:right way to maintain bi-directional relationships
Next Topic:Eclipselink 2.6.4 LEFT JOIN TREAT QUERY Not working properly
Goto Forum:
  


Current Time: Mon Dec 11 23:01:40 GMT 2017

Powered by FUDForum. Page generated in 0.01754 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software