The following situation: A session is in r15. A change is made in a "live association cache", i.e. in a cache where the cached list can be changed directly (e.g. by reordering or adding). The local cache is requested. Before the refetch in the commit, a new object is added in a 2nd session (in r16).
Now the commit(r17) fails.
The reason is that first the local !DBContext is removed and then the association caches are updated. But the session is not updated to r17 yet, so the new objects are not visible anymore (they were before because they were visible via the DBContext) and so it comes to a DeletedObjectAccess.
Noticed in Project
When re-sorting the projects in Prime via maintenance page /com.top_logic.project.pos/webapp/jsp/administration/maintenance/SortProjects.jsp analog:
List childs = ProjectRoot::getChildren(); Collections.sort(childs); ProjectRoot::setValue(StructuredElement.CHILDREN_ATTR, childs);
Did the following error occur in the commit when updating/publishing the KB caches:
2020-06-18 17:42:08,931 ERROR [Default Executor-thread-30]: c.i._._SortProjects -- Error: Failed to update project sort order. 2020-06-18 17:42:08,932 ERROR [Default Executor-thread-30]: c.i._._SortProjects -- com.top_logic.knowledge.service.db2.DeletedObjectAccess: Object hasStructureChild:7333763 already deleted. com.top_logic.knowledge.service.db2.DeletedObjectAccess: Object hasStructureChild:7333763 already deleted. at com.top_logic.knowledge.service.db2.DBKnowledgeItem.checkAlive(DBKnowledgeItem.java:836) at com.top_logic.knowledge.service.db2.DBKnowledgeItem.getAttributeValue(DBKnowledgeItem.java:175) at com.top_logic.knowledge.service.db2.DBKnowledgeItem.getAttributeValue(DBKnowledgeItem.java:169) at com.top_logic.knowledge.service.db2.DynamicKnowledgeItem.getAttributeValue(DynamicKnowledgeItem.java:101) at com.top_logic.knowledge.service.db2.DBKnowledgeItem.getAttributeValue(DBKnowledgeItem.java:125) at com.top_logic.knowledge.service.db2.AbstractDBKnowledgeItem.getAttributeValue(AbstractDBKnowledgeItem.java:298) at com.top_logic.knowledge.service.db2.LiveAssociationsList.getPosition(LiveAssociationsList.java:137) at com.top_logic.knowledge.service.db2.LiveAssociationsList.internalAdd(LiveAssociationsList.java:124) at com.top_logic.knowledge.service.db2.LiveAssociationsList.addLinkResolved(LiveAssociationsList.java:111) at com.top_logic.knowledge.service.db2.Associations.addLink(Associations.java:56) at com.top_logic.knowledge.service.db2.AssociationCache.createLocalCache(AssociationCache.java:286) at com.top_logic.knowledge.service.db2.AssociationCache.validateLocalCacheInCommit(AssociationCache.java:454) at com.top_logic.knowledge.service.db2.AssociationCache.internalCommit(AssociationCache.java:497) at com.top_logic.knowledge.service.db2.DefaultDBContext.publishAssociationCaches(DefaultDBContext.java:1063) at com.top_logic.knowledge.service.db2.DefaultDBContext.localCommit(DefaultDBContext.java:1056) at com.top_logic.knowledge.service.db2.DefaultDBContext.commitTransaction(DefaultDBContext.java:784) at com.top_logic.knowledge.service.db2.DefaultDBContext.commitAnonymous(DefaultDBContext.java:717) at com.top_logic.knowledge.service.db2.DBKnowledgeBase.commit(DBKnowledgeBase.java:2846) at com.top_logic.util.MaintenanceJspBase.commit(MaintenanceJspBase.java:294) at com.ibm._jsp._SortProjects.doWork(_SortProjects.java:100) at com.top_logic.util.MaintenanceJspBase.runWork(MaintenanceJspBase.java:317) at com.ibm._jsp._SortProjects._jspService(_SortProjects.java:389)
Test
TestAssociationCacheOrdered#testUpdateCacheOnConcurrentChange