Missing session and token - 3.0.23

Facing “missing session and token” exceptions

Dependencies
“com.michaelpollmeier” %% “gremlin-scala” % “3.4.1.12”
“com.orientechnologies” % “orientdb-gremlin” % “3.0.23”

OrientDB 3.0.23 GA Community Edition

Exception
com.orientechnologies.orient.enterprise.channel.binary.OTokenSecurityException: missing session and token at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleException(OChannelBinaryAsynchClient.java:338) at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:285) at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:307) at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:196) at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:158) at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1847) at com.orientechnologies.orient.client.remote.OStorageRemote.lambda$networkOperationRetryTimeout$2(OStorageRemote.java:244) at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:303) at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:227) at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationNoRetry(OStorageRemote.java:257) at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:959) at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.command(ODatabaseDocumentRemote.java:422) at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lambda$querySql$4(OrientGraph.java:283) at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.executeWithConnectionCheck(OrientGraph.java:205) at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.querySql(OrientGraph.java:281) at org.apache.tinkerpop.gremlin.orientdb.OrientGraphQuery.execute(OrientGraphQuery.java:32) at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$elements$6(OrientGraphStep.java:78) at java.util.Optional.map(Optional.java:215) at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.elements(OrientGraphStep.java:77) at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.vertices(OrientGraphStep.java:48) at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$new$0(OrientGraphStep.java:40) at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:155) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38) at org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:179) at org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:117) at gremlin.scala.GremlinScala.toList(GremlinScala.scala:62) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.getCorporateAttribute_aroundBody4(AttributeDao.scala:406) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl$AjcClosure5.run(AttributeDao.scala:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:167) at com.slb.utility.logging.MethodLogger.around(MethodLogger.scala:38) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.getCorporateAttribute(AttributeDao.scala:387) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.createCorporateAttribute_aroundBody6(AttributeDao.scala:571) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl$AjcClosure7.run(AttributeDao.scala:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:167) at com.slb.utility.logging.MethodLogger.around(MethodLogger.scala:38) at com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.createCorporateAttribute(AttributeDao.scala:475) at com.slb.corporateplan.hierarchy.service.AttributeServiceImpl.$anonfun$createCorporateAttribute$1(AttributeService.scala:101) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Suppressed: com.orientechnologies.orient.enterprise.channel.binary.OTokenSecurityException: missing session and token at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.onBeforeOperationalRequest(ONetworkProtocolBinary.java:458) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.sessionRequest(ONetworkProtocolBinary.java:265) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.execute(ONetworkProtocolBinary.java:211) at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)

Hi @abhishek

i’ve just pushed a fix on Gremlin Driver. It will be available in the next release 3.0.25, or in the next snapshot

Thanks

Hi @wolf4ood

We just tried upgrading the orientdb server and the orientdb gremlin client to 3.0.25
We are still facing the same issue.

Orient DB Version
OrientDB console v.3.0.25 - Veloce (build 2a229d542568b8d413b8633cca1f34239449d13e

Gremlin Driver
val scalaGremlin = “com.michaelpollmeier” %% “gremlin-scala” % “3.4.4.1”
val orientDbGremlin = “com.orientechnologies” % “orientdb-gremlin” % “3.0.25”

Exception:

    com.orientechnologies.orient.enterprise.channel.binary.OTokenSecurityException: missing session and token at
 sun.reflect.GeneratedConstructorAccessor14.newInstance(Unknown Source) at
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at
 java.lang.reflect.Constructor.newInstance(Constructor.java:423) at
 com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleException(OChannelBinaryAsynchClient.java:338) at
 com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:285) at
 com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:307) at
 com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:196) at
 com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:158) at
 com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1847) at
 com.orientechnologies.orient.client.remote.OStorageRemote.lambda$networkOperationRetryTimeout$5(OStorageRemote.java:244) at
 com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:303) at
 com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:227) at
 com.orientechnologies.orient.client.remote.OStorageRemote.networkOperation(OStorageRemote.java:261) at
 com.orientechnologies.orient.client.remote.OStorageRemote.query(OStorageRemote.java:924) at
 com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.query(ODatabaseDocumentRemote.java:381) at
 org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lambda$querySql$4(OrientGraph.java:283) at
 org.apache.tinkerpop.gremlin.orientdb.OrientGraph.executeWithConnectionCheck(OrientGraph.java:205) at
 org.apache.tinkerpop.gremlin.orientdb.OrientGraph.querySql(OrientGraph.java:281) at
 org.apache.tinkerpop.gremlin.orientdb.OrientGraphQuery.execute(OrientGraphQuery.java:32) at
 org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$elements$6(OrientGraphStep.java:78) at
 java.util.Optional.map(Optional.java:215) at
 org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.elements(OrientGraphStep.java:77) at
 org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.vertices(OrientGraphStep.java:48) at
 org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$new$0(OrientGraphStep.java:40) at
 org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:157) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at
 org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) at
 org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128) at
 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38) at
 org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:180) at
 org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:118) at
 gremlin.scala.GremlinScala.toList(GremlinScala.scala:62) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.getCorporateAttribute_aroundBody4(AttributeDao.scala:419) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl$AjcClosure5.run(AttributeDao.scala:1) at
 org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:167) at
 com.slb.utility.logging.MethodLogger.around(MethodLogger.scala:38) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.getCorporateAttribute(AttributeDao.scala:400) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.createCorporateAttribute_aroundBody6(AttributeDao.scala:589) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl$AjcClosure7.run(AttributeDao.scala:1) at
 org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:167) at
 com.slb.utility.logging.MethodLogger.around(MethodLogger.scala:38) at
 com.slb.corporateplan.hierarchy.dao.AttributeDaoImpl.createCorporateAttribute(AttributeDao.scala:488) at
 com.slb.corporateplan.hierarchy.service.AttributeServiceImpl.$anonfun$createCorporateAttribute$1(AttributeService.scala:128) at
 scala.util.Success.$anonfun$map$1(Try.scala:255) at
 scala.util.Success.map(Try.scala:213) at
 scala.concurrent.Future.$anonfun$map$1(Future.scala:292) at
 scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33) at
 scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33) at
 scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at
 akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at
 akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:92) at
 scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at
 scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at
 akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:92) at
 akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) at
 akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49) at
 akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at
 akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at
 akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at
 akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Suppressed: com.orientechnologies.orient.enterprise.channel.binary.OTokenSecurityException: missing session and token at
 com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.onBeforeOperationalRequest(ONetworkProtocolBinary.java:459) at
 com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.sessionRequest(ONetworkProtocolBinary.java:266) at
 com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.execute(ONetworkProtocolBinary.java:212) at
 com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)

Thanks,
Abhishek

Hi @abhishek

can you tell me if you are running a transaction before the query?

Thanks

Hi @wolf4ood

Yes we are running a transaction.
val graph = factory.getTx().asScala

Thanks,
Abhishek

Hi @abhishek

is it a long running transaction?

Can you summarize which operations do you do?

Thanks

Hi @wolf4ood

Yes it is a long transaction.
We create multiple nodes (varies between 20-50) and multiple edges (around 30) and around 10 node updates as well.
We do delete a few nodes and edges (around 5 each).

We also make a query to get back all the created nodes and relationships.

Although we never face this issue when we deploy a single instance of OrientDb and use the same. It only happens when we use clustered setup with 3 nodes.

Thanks,
Abhishek

@abhishek

ok got it, do you use some kind of load balancing or connection strategy?

http://orientdb.com/docs/3.0.x/distributed/Distributed-Configuration.html#load-balancing

@wolf4ood

we haven’t set any of the strategy so it must be using whichever is the default one.
For connection we use Kubernetes DNS and connect it as

orient-db-service.default.svc.cluster.local/DBName

Hi @abhishek

that must be the problem. By using kube DNS it will loadbalance requests i guess, and it will cause Missing token exception.

You should use use stateful set with stable network identities in order to avoid kube loadbalancer

Let me know if that helps

Thanks