A NullPointerException is thrown when deleting a document in Orient 1.6.4 plocal embedded document database
This is really scary. When this happens, all our other records do not show up in the UI. The document does get deleted, but I wonder if the data is consistent.
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Error on deleting record in cluster #15
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeDeleteRecord(ODatabaseRecordAbstract.java:932)
at com.orientechnologies.orient.core.tx.OTransactionNoTx.deleteRecord(OTransactionNoTx.java:114)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.delete(ODatabaseRecordTx.java:286)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.delete(ODatabaseRecordTx.java:38)
at com.orientechnologies.orient.core.record.ORecordAbstract.delete(ORecordAbstract.java:317)
at models.Orient$118.execute(Orient.java:4962)
at controllers.DatabaseExecutor.execute(DatabaseExecutor.java:15)
at models.Orient.deleteLoan(Orient.java:4918)
at controllers.Loan.editPOST(Loan.java:1153)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
... 1 more
Caused by: java.lang.NullPointerException
at com.orientechnologies.orient.core.index.sbtreebonsai.local.OSBTreeBonsaiBucket.getEntry(OSBTreeBonsaiBucket.java:206)
at com.orientechnologies.orient.core.index.sbtreebonsai.local.OSBTreeBonsai.findBucket(OSBTreeBonsai.java:1250)
at com.orientechnologies.orient.core.index.sbtreebonsai.local.OSBTreeBonsai.remove(OSBTreeBonsai.java:550)
at com.orientechnologies.orient.core.db.record.ridset.sbtree.OIndexRIDContainerSBTree.remove(OIndexRIDContainerSBTree.java:140)
at com.orientechnologies.orient.core.db.record.ridset.sbtree.OIndexRIDContainerSBTree.remove(OIndexRIDContainerSBTree.java:136)
at com.orientechnologies.orient.core.db.record.ridset.sbtree.OIndexRIDContainer.remove(OIndexRIDContainer.java:120)
at com.orientechnologies.orient.core.index.OIndexMultiValues.remove(OIndexMultiValues.java:177)
at com.orientechnologies.orient.core.tx.OTransactionNoTx.addIndexEntry(OTransactionNoTx.java:186)
at com.orientechnologies.orient.core.index.OIndexTxAware.remove(OIndexTxAware.java:89)
at com.orientechnologies.orient.core.index.OClassIndexManager.deleteIndexKey(OClassIndexManager.java:475)
at com.orientechnologies.orient.core.index.OClassIndexManager.deleteIndexEntries(OClassIndexManager.java:260)
at com.orientechnologies.orient.core.index.OClassIndexManager.onRecordAfterDelete(OClassIndexManager.java:221)
at com.orientechnologies.orient.core.hook.ODocumentHookAbstract.onTrigger(ODocumentHookAbstract.java:281)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.callbackHooks(ODatabaseRecordAbstract.java:1065)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeDeleteRecord(ODatabaseRecordAbstract.java:911)
I shutdown our application and the connected to the database via console. There are 104 records in the table, but it throws some weird exception:
orientdb> select count(*) from Loan where Lender.MailAddress='[email protected]'
Error on using index IndexChain{Loan.Lender, User.MailAddress} in query 'select count(*) from Loan where Lender.MailAddress='[email protected]''. Probably you need to rebuild indexes. Now executing query using cluster scan
java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
-> com.orientechnologies.orient.core.serialization.serializer.binary.impl.OLinkSerializer.preprocess(OLinkSerializer.java:37)
-> com.orientechnologies.orient.core.index.sbtree.local.OSBTree.get(OSBTree.java:160)
-> com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.get(OSBTreeIndexEngine.java:352)
-> com.orientechnologies.orient.core.index.OIndexMultiValues.count(OIndexMultiValues.java:82)
-> com.orientechnologies.orient.core.index.OIndexAbstractDelegate.count(OIndexAbstractDelegate.java:80)
-> com.orientechnologies.orient.core.sql.OChainedIndexProxy.count(OChainedIndexProxy.java:165)
-> com.orientechnologies.orient.core.sql.operator.OQueryOperatorEquals.executeIndexQuery(OQueryOperatorEquals.java:134)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchForIndexes(OCommandExecutorSQLSelect.java:732)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:630)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:139)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:374)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:348)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:333)
-> com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:57)
-> com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:96)
-> com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:85)
-> com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
-> com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:82)
-> com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
-> com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.query(ODatabaseRecordAbstract.java:505)
-> com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.query(ODatabaseRecordWrapperAbstract.java:188)
-> com.orientechnologies.orient.console.OConsoleDatabaseApp.select(OConsoleDatabaseApp.java:747)
-> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-> java.lang.reflect.Method.invoke(Method.java:606)
-> com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:279)
-> com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:156)
-> com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:94)
-> com.orientechnologies.orient.graph.console.OGremlinConsole.main(OGremlinConsole.java:53)
----+-----+-----
# |@RID |count
----+-----+-----
0 |#-2:0|104
----+-----+-----
1 item(s) found. Query executed in 0.134 sec(s).
I did rebuild those 2 indexes, but still it shows the same error. Any idea?
Hi Arul, Is this state of database after crash ? Did you drop/create index in such case ? About class cast exception could you check this on 1.7-rc2 we have already fixed given issue in 1.7rc1. We can not move fixes between versions, main reason is that code changes based on changes of other components and moving some fixes from 1.7-rc2 to 1.6.4 will make it 1.7rc2 so you will use 1.7rc2 any way. Second reason is that such fix movements will make definition of release version senseless and when user will report issue in some version we will have no idea whether fix which we provided in previous version was incorrect or user has older version of 1.6.4 in which this fix is absent.
Hi Andrey, This started to happen when running our app, so this did not happen after a crash, there was no drop/create index performed. I took it down because nothing shows up in our app and it does not propagate exception trace to application which makes it difficult to know the root cause. Then I shutdown my app and rebuild those 2 indexes via console did not help. Then tried to rebuild all the indexes, ran into a NPE.
orientdb> REBUILD INDEX *
Rebuilding index(es)...
Error: java.lang.NullPointerException
orientdb>
Re-ran REBUILD again and it worked this time fine. My concern is 1.7 is still in development and we are already on production on 1.6.4, so we have no plans to upgrade to 1.7 in near future unless it becomes stable and GA.
Can we reproduce this? Arul, could you share a piece of this db in private to see what happens?
This already fixed in 1.7-rc1, but the only way to be sure is try and confirm that it is fixed.
Guys I have closed this issue. If it will appear in 1.7-rc2 please reopen it.
Hi guys, I have a similar problem with v1.7.10. I do know if it is related to this issue, but it seems that it is the only reference to "Error on using index IndexChain":
2015-03-03 14:46:36,515 - ERROR - com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect:
Error on using index IndexChain{_bb_user.user.name, OUser.name} in query 'select from _BB_User where ( user.name not in ? and (user.name= 'xxxxxxxxx') )'. Probably you need to rebuild indexes. Now executing query using cluster scan
com.orientechnologies.orient.core.index.sbtree.local.OSBTreeException: Null keys are not supported.
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.checkNullSupport(OSBTree.java:1072) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.get(OSBTree.java:494) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.get(OSBTreeIndexEngine.java:252) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.index.OIndexOneValue$1.nextEntry(OIndexOneValue.java:140) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OChainedIndexProxy.cursorToList(OChainedIndexProxy.java:368) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OChainedIndexProxy.applyFirstIndex(OChainedIndexProxy.java:352) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OChainedIndexProxy.applyTailIndexes(OChainedIndexProxy.java:339) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OChainedIndexProxy.get(OChainedIndexProxy.java:294) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.operator.OQueryOperatorEquals.executeIndexQuery(OQueryOperatorEquals.java:125) ~[com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchForIndexes(OCommandExecutorSQLSelect.java:1158) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:701) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:136) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:441) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:425) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:392) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:60) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:114) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:103) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:80) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29) [com.orientechnologies.orientdb-core-1.7.10.jar:1.7.10]
at com
Seems the lookup of NULL has been executed, but in this case the index must support NULL and you can do it at creation time only.