Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Deadlocks since activation of Shared Cache
Deadlocks since activation of Shared Cache [message #1801531] Mon, 21 January 2019 21:53 Go to next message
ALEXANDRE JACOB is currently offline ALEXANDRE JACOBFriend
Messages: 1
Registered: January 2019
Junior Member

I configured shared cache on some of our entities and since then we are facing rare deadlocks happening just after getting this exception :

Exception [EclipseLink-2004] (Eclipse Persistence Services - 2.7.2.v20180622-f627448): 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(
        at org.eclipse.persistence.internal.helper.ConcurrencyManager.releaseReadLock(
        at org.eclipse.persistence.internal.identitymaps.CacheKey.releaseReadLock(
        at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(
        at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(
        at org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent(
        at org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor.getFromIdentityMap(
        at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(
        at org.eclipse.persistence.queries.ObjectBuildingQuery.registerIndividualResult(
        at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturn(
        at org.eclipse.persistence.mappings.OneToOneMapping.checkCacheForBatchKey(
        at org.eclipse.persistence.mappings.ForeignReferenceMapping.extractResultFromBatchQuery(
        at org.eclipse.persistence.internal.indirection.BatchValueHolder.instantiate(
        at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(
        at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(
        at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(
        at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(
        at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(
        at fr.ajacob.entity.PromotionTypeStore._persistence_get_store(
        at fr.ajacob.entity.PromotionTypeStore.getStore(

The 3 following entities seem to be related to this error, here is a summary of each of them (relevant parts) :

public class PromotionType {

	private Integer id;


	@BatchFetch(value = BatchFetchType.IN)
	@OneToMany(mappedBy = "promotionType", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<PromotionTypeStore> promotionTypeStores;


	public PromotionTypeStore getPromotionTypeStore(Store store) {
		for (PromotionTypeStore promotionTypeStore : this.getPromotionTypeStores()) {
			if (promotionTypeStore.getStore().equals(store)) {                                        // ==> line 255
				return promotionTypeStore;
		return null;

public class PromotionTypeStore {

    @JoinColumn(name = "id_promotion_type", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private PromotionType promotionType;

    @JoinColumn(name = "id_store", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Store store;

    (... other columns mapped ...)

    public PromotionType getPromotionType() {
        return promotionType;

    public void setPromotionType(PromotionType promotionType) {
        this.promotionType = promotionType;

    public Store getStore() {
        return store;

    public void setStore(Store store) { = store;

public class Store {

        @Column(name = "id", nullable = false)
	private Integer id;


They are all declared to be cacheable (shared cache)

I found this very interesting link giving good advice when using shared cache.

Now I wonder :

- Does my configuration look wrong ?
- The link says to declare relationships as LAZY, shall I declare PromotionType.promotionTypeStores to be LAZY ?
- I am using an @IdClass on PromotionTypeStore which is in the shared cache. Is this a bad idea ?
- Shall I declare PromotionTypeStore.promotionType and @Noncacheable ?
- I manually call Cache.evict(<class>) on classes PromotionType and PromotionTypeStore, does the cache eviction need to be done in a transaction ?

The bug occurs once every 3 days, when it occurs all the threads get stuck and the server need to be restarted.
I've not yet managed to get a thread dump, I'll try to get one asap.

I tried to reproduce it in a development environment without success.

Thank you !
Re: Deadlocks since activation of Shared Cache [message #1801747 is a reply to message #1801531] Fri, 25 January 2019 15:09 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
How is the PromotionType instance you are calling getPromotionTypeStore on read in? Is it being cached and possibly reused by other threads?

Configuration looks fine to me, though I don't know what effect having the @Noncacheable annotation on the PromotionType. promotionTypeStores reference might play in this issue. If possible, you might try allowing it to be cacheable.

Best Regards,
Previous Topic:what really means weave and why is important
Next Topic:Mapping to single inheritance strategy fails "Conversion failed when converting the nvarchar va
Goto Forum:

Current Time: Wed Jul 24 09:34:38 GMT 2024

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

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

Back to the top