(OUST) Deletion of orgunit elsewhere causes OUST to fail

Bug #1399635 reported by Halvdan Hoem Grelland on 2014-12-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DHIS
Medium
Morten Olav Hansen

Bug Description

DHIS 2.17 and 2.18 trunk

Reproduce:
1. Load orgunits into web session somehow (e.g. open organisationunit maintanence and view the orgunit list).
2. Delete an orgunit using web api (or directly in DB)
3. Re-load any page which displays the orgunit selection tree

The tree will not display fully and an exception is thrown indicating that the deleted orgunit could not be fetched from DB.

Also, the tree seems to not load for any user, not just the current one.

Clearing the second level cache before accessing the OUST or orgunit list page DOES fix the problem.

To fix, the state held in the orgunit selection tree must be updated and/or reloaded on deletion of an orgunit elsewhere to ensure no dead references. Alternatively, the version could somehow be held alongside the tree and checked on load to evict any corrupt objects (tried this, couldn't get it to work, still possible probably).

Changed in dhis2:
milestone: none → 2.18
importance: Undecided → Medium
assignee: nobody → Morten Olav Hansen (mortenoh)

Cannot reproduce in current version, so assuming it is fixed.

Changed in dhis2:
status: New → Fix Released
Download full text (13.0 KiB)

Oops. Spoke too soon. Still there in current release.

* ERROR 2015-09-18 10:30:22,684 Error while executing action (ExceptionInterceptor.java [http-bio-8080-exec-6])
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.hisp.dhis.organisationunit.OrganisationUnit#76]
 at org.hibernate.internal.SessionFactoryImpl$1$1.handleEntityNotFound(SessionFactoryImpl.java:247)
 at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:214)
 at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:264)
 at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
 at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1053)
 at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:980)
 at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:714)
 at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:282)
 at org.hibernate.collection.internal.PersistentSet.initializeFromCache(PersistentSet.java:141)
 at org.hibernate.cache.spi.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:57)
 at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:148)
 at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:70)
 at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1810)
 at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:552)
 at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:234)
 at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:548)
 at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:126)
 at org.hibernate.collection.internal.PersistentSet.toArray(PersistentSet.java:188)
 at java.util.ArrayList.addAll(ArrayList.java:577)
 at org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitListAction.execute(GetOrganisationUnitListAction.java:109)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
 at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:85)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleIntercepto...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers