MemoryIndexing.flush does not lock indexes properly
@luukkainen ran into this with release/1.43.1
:
java.lang.NullPointerException: null
at org.simantics.db.indexing.IndexedRelationsSearcherBase.doSearchResources(IndexedRelationsSearcherBase.java:924)
at org.simantics.db.indexing.IndexedRelationsSearcher.persistentCachedSearchResources(IndexedRelationsSearcher.java:172)
at org.simantics.db.indexing.IndexedRelationsSearcher.doSearchResources(IndexedRelationsSearcher.java:219)
at org.simantics.db.indexing.IndexedRelationsImpl.queryResources(IndexedRelationsImpl.java:327)
at org.simantics.db.layer0.genericrelation.DependenciesRelation.queryResources(DependenciesRelation.java:268)
at org.simantics.db.layer0.genericrelation.DependencyResources$1.perform(DependencyResources.java:70)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:112)
... 48 common frames omitted
Wrapped by: org.simantics.db.exception.DatabaseException: java.lang.NullPointerException
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:124)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:669)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1929)
at fi.vtt.simantics.procore.internal.QueryControlImpl.syncRequestIndependent(QueryControlImpl.java:155)
at org.simantics.db.layer0.genericrelation.DependencyResources.apply(DependencyResources.java:67)
It would seem that searcher
is null
at org.simantics.db.indexing.IndexedRelationsSearcherBase.doSearchResources(IndexedRelationsSearcherBase.java:924)
.
The issue is not easily reproducible in normal use but it would seem plausible that the problem boils down to MemoryIndexing.flush
not having any kind of locking which is currently embedded in IndexedRelationsImpl
. This will need some refactoring to get the locking in there or possibly moving the flush logic into IndexedRelationsImpl.