-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multithreaded reads not possible with OrientGraph because of java.nio.BufferUnderflowException? #1815
Comments
@Laa may you look at this issue please? |
Sorry I've just got that you're using "local". Can you try the same code but using plocal? graph = new OrientGraph( "plocal:/xxx/yyy/gremlin_orientdb", "admin", "admin"); Remember to delete the database folder before to run it. |
Thanks Luca, it seems this was the problem. With plocal the exception does not occur anymore. I tried it with 100 threads without errors. For me it is good enough, but local is not thread safe anyways. Is "local" deprecated? Maybe the wiki should be changed to plocal, because this wiki page below contains "local" used as protocol with hints to the proper usage of multi threading: |
The new engine is "plocal". "Local" will be kept for a while. You're right, that page had the old "local. Changed it, thanks. |
Hi @lvca .. Server Log:
|
Hi @nishantkumar1292 what version do you use? |
Hi @Laa |
@nishantkumar1292 I suppose page corruption was caused by force close. Do you use WAL when you work with a server? About solution for your problem, you should make export/import database from to JSON. What was the reason of force close? Could you explain? |
Will export/import rectify the Also tried to run
@Laa Please help....this is now becoming a bottle neck for our project. We are not able to proceed further due to this error. |
export/import will restore your physical database struсture, so issues will be gone. I suppose you did not change any settings, I mean you did not switch off files explicitly. WAL is database operation journal. Do you see database restore procedure after database close? |
Should I remove the database after export and then import? Or directly perform the export/import one after another? |
You export from old database and import to completely new database |
@Laa ..One more thing. |
@nishantkumar1292 I suppose, I am not expert in distributed, you have to do this on a single node and then wait till it will be replicated on the second node. |
Hi @Laa Just tried importing the database but got an error. LOGS
|
@nishantkumar1292 Could you send me your JSON file? |
Hi .. @Laa Had to remove the link because of privacy reasons. |
@nishantkumar1292 here is fixed db the only issue left is that index category_listing_or_idx indicates that there are some duplicated records. there are few of them but they have to be removed manually. |
@Laa ... I have the corrected file now. Please remove that file from your comment as it contains internal company data. We can share it privately if needed. |
Version 1.6. Community Edition
After two days of trial and error i think the behavior is not correct, because i cannot get any environment running without the error java.nio.BufferUnderflowException in OByteBufferUtils. Only single threaded code runs without problems and one single run of the example with 10 threads finished without the exception.
Maybe i do something wrong, but this exception gives me no hint what it is. See example and output below.
Expected: Read records from OrientGraph with multiple threads from the same database.
This should not be that hard i thought, but even the simplest query (getVertex with fix RecordID) runs into the exception.
According to the documentation i created a separate OrientGraph instance per thread. So i expect the example should be thread safe.
The example which crashes:
public static void main(String[] args) {
My output:
Thread:Thread[Thread-4,5,main] v(Products)[#11:1]
Thread:Thread[Thread-8,5,main] v(Products)[#11:1]
Thread:Thread[Thread-5,5,main] v(Products)[#11:1]
Exception in thread "Thread-9" Thread:Thread[Thread-3,5,main] v(Products)[#11:1]
Exception in thread "Thread-0" com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #11:1 (cluster: products)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:249)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeReadRecord(ODatabaseRecordAbstract.java:706)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.loadRecord(OTransactionOptimistic.java:258)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:202)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:38)
at com.orientechnologies.orient.core.id.ORecordId.getRecord(ORecordId.java:296)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertex(OrientBaseGraph.java:429)
at com.orientdbtest.BugTest$1.run(BugTest.java:21)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:472)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
at com.orientechnologies.common.util.OByteBufferUtils.mergeShortFromBuffers(OByteBufferUtils.java:63)
at com.orientechnologies.orient.core.storage.fs.OFileMMap.readShort(OFileMMap.java:225)
at com.orientechnologies.orient.core.storage.impl.local.OClusterLocal.getPhysicalPosition(OClusterLocal.java:316)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1764)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1127)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:243)
... 8 more
com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #11:1 (cluster: products)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:249)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeReadRecord(ODatabaseRecordAbstract.java:706)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.loadRecord(OTransactionOptimistic.java:258)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:202)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:38)
at com.orientechnologies.orient.core.id.ORecordId.getRecord(ORecordId.java:296)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertex(OrientBaseGraph.java:429)
at com.orientdbtest.BugTest$1.run(BugTest.java:21)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:472)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
at com.orientechnologies.common.util.OByteBufferUtils.mergeShortFromBuffers(OByteBufferUtils.java:63)
at com.orientechnologies.orient.core.storage.fs.OFileMMap.readShort(OFileMMap.java:225)
at com.orientechnologies.orient.core.storage.impl.local.OClusterLocal.getPhysicalPosition(OClusterLocal.java:316)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1764)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1127)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:243)
... 8 more
Exception in thread "Thread-7" com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #11:1 (cluster: products)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:249)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeReadRecord(ODatabaseRecordAbstract.java:706)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.loadRecord(OTransactionOptimistic.java:258)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:202)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:38)
at com.orientechnologies.orient.core.id.ORecordId.getRecord(ORecordId.java:296)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertex(OrientBaseGraph.java:429)
at com.orientdbtest.BugTest$1.run(BugTest.java:21)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:472)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
at com.orientechnologies.common.util.OByteBufferUtils.mergeShortFromBuffers(OByteBufferUtils.java:63)
at com.orientechnologies.orient.core.storage.fs.OFileMMap.readShort(OFileMMap.java:225)
at com.orientechnologies.orient.core.storage.impl.local.OClusterLocal.getPhysicalPosition(OClusterLocal.java:316)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1764)
at com.orientechnologies.orient.core.storage.impl.local.OStorageLocal.readRecord(OStorageLocal.java:1127)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:243)
... 8 more
Thread:Thread[Thread-2,5,main] v(Products)[#11:1]
Thread:Thread[Thread-6,5,main] v(Products)[#11:1]
Thread:Thread[Thread-1,5,main] v(Products)[#11:1]
The text was updated successfully, but these errors were encountered: