Bug 990587 - [HHH-7959] Hibernate/Infinispan 2nd Level Caches set to transaction-mode=NONE stop functioning after an explicit eviction
Summary: [HHH-7959] Hibernate/Infinispan 2nd Level Caches set to transaction-mode=NONE...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER1
: EAP 6.2.0
Assignee: Brett Meyer
QA Contact: Zbyněk Roubalík
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks: 990594 eap62-upgrade-hibernate425
TreeView+ depends on / blocked
 
Reported: 2013-07-31 13:41 UTC by csams
Modified: 2018-12-03 19:29 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
: 990594 (view as bug list)
Environment:
Last Closed: 2013-12-15 16:12:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description csams 2013-07-31 13:41:47 UTC
Description of problem:
The caches in the 'infinispan' subsystem configured with <transaction mode="NONE"/> (which results in no transaction used by 2LC) get stuck in state= CLEARING when you perform a programmatic evict() on them to clear the caches. (Using e.g. em.getEntityManagerFactory().getCache().evictAll() or the evict* from the Cache gotten from the SessionFactory)
The problem seem to lie within the class 'org.hibernate.cache.infinispan.impl.BaseRegion, where the 'checkValid' method fails to clear the cache (and set back the state to VALID). The reason it fails is because it calls: cacheAdapter.withinTx(), which in turn tries to get the TransactionManager from the cache (which seems to be null for these non-transactional caches), and then NPEs on the tm.begin(); The NPE is caught and logs out (TRACE in org.hibernate.cache.infinispan.impl.BaseRegion) "Could not invalidate region: null", and never set the state in VALID. So from thereon the caches are in an Invalid state and are not used anymore by Infinispan, thus leading to much performance degradation.

Version-Release number of selected component (if applicable):
EAP 6.0.1 / Hibernate 4.1.3

How reproducible:
Always

Steps to Reproduce:
0. Set org.hibernate.cache logging category to TRACE.
1. Execute a cacheable query with cacheable entities.
2. Execute all of the evict* methods:
		HibernateEntityManagerFactory hEmf = (HibernateEntityManagerFactory)em.getEntityManagerFactory();
		Cache cache = hEmf.getSessionFactory().getCache();
		cache.evictEntityRegions();
		cache.evictCollectionRegions();
		cache.evictDefaultQueryRegion();
		cache.evictQueryRegions();
3. Execute the query again.

Actual results:
See "Could not invalidate region: null" at TRACE level in the logs, and the query cache stops working.

Expected results:
No trace level message

Additional info:

Comment 1 Brett Meyer 2013-08-20 15:19:55 UTC
Fix pushed to http://git.app.eng.bos.redhat.com/?p=hibernate/hibernate-core.git;a=shortlog;h=refs/heads/eap61-cp-updates, but EAP 6.2.0 should have a Hibernate upgrade anyway.

Comment 2 Zbyněk Roubalík 2013-09-23 11:21:11 UTC
EAP 6.2.0.ER1


Note You need to log in before you can comment on or make changes to this bug.