orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB
Apache License 2.0
91 stars 32 forks source link

Error in multi-threaded environment - getIndexManager #86

Closed ttschampel closed 7 years ago

ttschampel commented 8 years ago

When executing in a multi-threaded environment I get errors from calls into OrientGraph.getIndexManager()

Adding makeActiveDb() to the method fixed the problem locally for me.

mpollmeier commented 8 years ago

For OrientDB the rule is that one database instance can be used by a thread, because database instances are not thread safe. https://github.com/orientechnologies/orientdb/issues/5490#issuecomment-219045655 https://github.com/mpollmeier/orientdb-gremlin/issues/16 http://orientdb.com/docs/last/Java-Multi-Threading.html

ttschampel commented 8 years ago

I saw the multithreading docs for OrientDB and the accompanying calls to makeActive() in the OrientGraph. My use case was executing a traversal during a txn (checking for the existence of a vertex) which indirectly hit the index manager.

Are you saying things are executing as expected? Perhaps I'm improperly using the API?

mpollmeier commented 8 years ago

I haven't actually tried to explicitly call makeActive when sharing the graph instance - I always went for multiple graph instances (one per thread).

ttschampel commented 7 years ago

I see #112 has been pulled in. This can be marked as a duplicate of that issue - the changes for 112 are the same I did for a local workaround to get past this problem.