Session expireTimeout

Hi

  • Question

change session expire time

  • Description

I use gremlin query language with orientdb.and i find the time that session be timeout is 1 hour.

how can i change it .

52HZ

Thanks

Hi @52HZ

which protocol/ driver are you using?

Probably this setting can help

http://orientdb.com/docs/3.0.x/admin/Configuration.html#networktokenexpiretimeout

Hi @wolf4ood

Thanks for your answer , what i used about OrientDB is :

       <dependency>
           <groupId>org.apache.tinkerpop</groupId>
           <artifactId>tinkergraph-gremlin</artifactId>
           <version>3.4.0</version>
       </dependency>

       <dependency>
           <groupId>com.orientechnologies</groupId>
           <artifactId>orientdb-gremlin</artifactId>
           <version>3.0.18</version>
       </dependency>

52HZ

Thanks

Hi @wolf4ood

I know this config about network.token.expireTimeout .

And ,I set it by the class called OrientDBConfig.Beacuse i used tinkerpop, I need OrientGraphFactory to open the connection. what i did is :

   OrientDBConfig build = OrientDBConfig.builder()
                .addConfig(OGlobalConfiguration.NETWORK_TOKEN_EXPIRE_TIMEOUT, 120)
                .addConfig(OGlobalConfiguration.DB_POOL_MAX, 100)
                .addConfig(OGlobalConfiguration.DB_POOL_MIN, 1)
                .build();

        LocalOrientDB orientDB = new LocalOrientDB(orientDbProperty.getUrl(), orientDbProperty.getUsername(), orientDbProperty.getPassword(), build);

        LocalOrientGraphFactory orientGraphFactory = new LocalOrientGraphFactory(orientDB, orientDbProperty.getDatabase(), ODatabaseType.PLOCAL, orientDbProperty.getUsername(), orientDbProperty.getPassword(), build);

There , I Overrided OrientGraphFactory and OrientDB. beacuse I can not get a method with a param called OrientDBConfig when i did OrientGraphFactory.getTx() or OrientGraphFactory.getNoTx()

  • Origin method
  /**
     * @param create if true automatically creates database if database with given
     *               URL does not exist
     * @param open   if true automatically opens the database
     */
    protected ODatabaseDocument acquireFromPool(boolean create, boolean open) {

        if (create && type.isPresent()) {
            this.factory.createIfNotExists(dbName, type.get());
        }

        final ODatabaseDocument databaseDocument = this.pool.acquire();

        if (databaseDocument.isClosed()) {
            throw new IllegalStateException("Database returned from document is closed");
        }

        return databaseDocument;

    }

    /**
     * @param create if true automatically creates database if database with given
     *               URL does not exist
     * @param open   if true automatically opens the database
     */
    @Override
    public ODatabaseDocument getDatabase(boolean create, boolean open) {

        if (create && type.isPresent()) {
            this.factory.createIfNotExists(dbName, type.get());
        }
        return this.factory.open(dbName, user, password);

    }
  • what I added
 /**
     *  add param called OrientDBConfig
     * @param create
     * @param orientDBConfig
     * @return
     * @author XYL
     * @since 20190413
     */
    protected ODatabaseDocument getDatabase(boolean create, OrientDBConfig orientDBConfig) {

        if (create && type.isPresent()) {
            this.factory.createIfNotExists(dbName, type.get());
        }

        return this.factory.open(dbName, user, password, orientDBConfig);
    }

 /**
     * add param called OrientDBConfig
     *
     * @param create
     * @param orientDBConfig
     * @return
     * @author XYL
     * @since 20190413
     */
    protected ODatabaseDocument acquireFromPool(boolean create, OrientDBConfig orientDBConfig) {

        if (create && type.isPresent()) {
            this.factory.createIfNotExists(dbName, type.get(), orientDBConfig);
        }

        final ODatabaseDocument databaseDocument = this.pool.acquire();

        if (databaseDocument.isClosed()) {
            throw new IllegalStateException("Database returned from document is closed");
        }

        return databaseDocument;

    }

  • And Then I Overrided OrientDB to change the method OrientDBConfig.defaultConfig() for adding some configs.

after those ,I test and find this is an ineffective method of setting the config in OrientDBConfig .

  • this is very strangely.So I trace the code . and find that no place to use the config called OGlobalConfiguration.NETWORK_TOKEN_EXPIRE_TIMEOUT

i do not know why.

52HZ

Thanks

Hi @52HZ

that configuration need to be in the server, not in the client.

Check here

http://orientdb.com/docs/3.0.x/admin/Configuration.html#changing-settings

Let me know if this helps

Thanks

Hi @wolf4ood

Thanks, what i did is that i added the config like this:

 OGlobalConfiguration.NETWORK_TOKEN_EXPIRE_TIMEOUT.setValue(10);

then after ten minutes,

com.orientechnologies.common.io.OIOException: Connection reset
	at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:450)
	at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:331)
	at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationNoRetry(OStorageRemote.java:361)
	at com.orientechnologies.orient.client.remote.OStorageRemote.reBeginTransaction(OStorageRemote.java:2112)
	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.checkAndSendTransaction(ODatabaseDocumentRemote.java:353)
	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.command(ODatabaseDocumentRemote.java:420)
	at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lambda$querySql$4(OrientGraph.java:271)
	at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.executeWithConnectionCheck(OrientGraph.java:193)
	at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.querySql(OrientGraph.java:269)
	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.util.DefaultTraversal.hasNext(DefaultTraversal.java:192)
	at cn.com.bmsmart.service.graphbuilder.strategy.language.GremlinGraphLanguageSelector.createNodes(GremlinGraphLanguageSelector.java:452)
	at cn.com.bmsmart.service.graphbuilder.strategy.language.GremlinGraphLanguageSelector.execute(GremlinGraphLanguageSelector.java:104)
	at cn.com.bmsmart.service.graphbuilder.strategy.data.GraphDataSource.graph(GraphDataSource.java:39)
	at cn.com.bmsmart.service.graphbuilder.strategy.data.instatnce.RedisInstanceGraphDataSource.execute(RedisInstanceGraphDataSource.java:92)
	at cn.com.bmsmart.service.graphbuilder.strategy.data.instatnce.RedisInstanceGraphDataSource.getData(RedisInstanceGraphDataSource.java:73)
	at cn.com.bmsmart.service.graphbuilder.strategy.data.all.RedisConceptAndInstanceGraphDataSource.execute(RedisConceptAndInstanceGraphDataSource.java:53)
	at cn.com.bmsmart.service.graphbuilder.strategy.data.all.RedisConceptAndInstanceGraphDataSource.getData(RedisConceptAndInstanceGraphDataSource.java:43)
	at cn.com.bmsmart.service.graphbuilder.strategy.rule.graph.ConceptAndInstanceGraph.execute(ConceptAndInstanceGraph.java:56)
	at cn.com.bmsmart.service.graphbuilder.strategy.rule.fusion.GraphFusionJsonRule.execute(GraphFusionJsonRule.java:59)
	at cn.com.bmsmart.service.graphbuilder.LocalGraphFusionService.graphFusion(LocalGraphFusionService.java:45)
	at cn.com.bmsmart.task.KngraphFusionTaskProcess.lambda$execute$0(KngraphFusionTaskProcess.java:74)
	at cn.com.bmsmart.task.CountableThreadPool$1.run(CountableThreadPool.java:65)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:210)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
	at java.io.DataInputStream.readByte(DataInputStream.java:265)
	at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.readByte(OChannelBinary.java:73)
	at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:174)
	at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:158)
	at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1953)
	at com.orientechnologies.orient.client.remote.OStorageRemote.lambda$networkOperationRetryTimeout$2(OStorageRemote.java:348)
	at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:407)
	... 32 more
  • maybe it is useful. but the exception is not session expire time out .

52HZ

Thanks

Yes seems not related to expire indeed.

Is it deterministic? Do you have a simple snippet to reproduce this issue?

Which version of the Server do you use?

Do you see some exception on the server log?

Thanks

Hi @wolf4ood

Yes,I am sure.

  • First, The version of the orietndb server is orientdb-tp3-3.1.0-SNAPSHOT
  • Second, I do not find some exception on ther serve log.

but now I find one thing that I reverted what i have overrided. and did like:

import javax.annotation.Resource;

/**
 * @author XYL
 * @Title: OrientDbConfig
 * @Description: TODO
 * @date 2018/11/1314:42
 */
@Configuration
public class OrientDbConfig {

    @Resource
    private OrientDbProperty orientDbProperty;

    @Bean
    public OrientGraphFactory orientGraphFactory() {

        OGlobalConfiguration.NETWORK_TOKEN_EXPIRE_TIMEOUT.setValue(10);

        OrientGraphFactory orientGraphFactory = new OrientGraphFactory(orientDbProperty.getUrl(), orientDbProperty.getUsername(), orientDbProperty.getPassword());

        return orientGraphFactory;
    }

}

  • then ,I do not met the exception like what i met yesterday ,it is :
com.orientechnologies.common.io.OIOException: Connection reset

  • it looks like that the reason that i met that exception is what I overrided.

it is very strange.

52HZ

Thanks

Hi @52HZ

why are you using 3.1.0-SNAPSHOT?

Hi @wolf4ood
oh…,which version i should use

52HZ

Thanks

@52HZ

since you are using orientdb-gremlin 3.0.18 from client you should use 3.0.18 as well on the server

Thanks

Hi @wolf4ood

Thanks,i will change it

52HZ

I am having the same issue with Connection Reset. Orientdb version 3.0.23 is used .

Exception encounter:

2019-10-15 20:30:49.367 INFO 11428 — [nio-8080-exec-1] c.o.orient.client.remote.OStorageRemote : Caught Network I/O errors on 52.210.185.243:32527/staging, trying an automatic reconnection… (error: Connection reset)
com.orientechnologies.common.io.OIOException: Connection reset
at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:346)
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:942)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.command(ODatabaseDocumentRemote.java:410)

Code used for creating the Pool =>

OrientDB orientDB = new OrientDB(“remote:” + host, user, pass, OrientDBConfig.defaultConfig());
OrientDBConfigBuilder poolCfg = OrientDBConfig.builder();
poolCfg.addConfig(OGlobalConfiguration.DB_POOL_MIN, Integer.parseInt(MIN_POOL_SIZE));
poolCfg.addConfig(OGlobalConfiguration.DB_POOL_MAX, Integer.parseInt(MAX_POOL_SIZE));
pool = new ODatabasePool(orientDB, dbName, user, pass);

Used in implementation:

ODatabasePool workingPool = CreateDatabasePool.getPool();
try (ODatabaseDocument db = workingPool.acquire()) {
//code here
OResultSet resultSet = db.command(totalCountQuery); (this one will throw the OIOException)
//code here
}

Hi,@blidiselalin
I met it because of making a wrong choice about version. you can think about yourself.

52HZ
Thanks

Hi, @52HZ

Can you please recommend a version that we should use in this case. 3.0.18 will be a better choice?

Thanks, Alin

Hi, @blidiselalin
I could not maker sure which is better. I can just tell you that I solve it by useing 3.0.18.

52HZ

Thanks

I have switched to orientdb 3.0.18 and now after a while we have not used the environment and at first log in I have received from api the same exception “c.o.orient.client.remote.OStorageRemote : Caught Network I/O errors on 52.210.185.243:32527/staging, trying an automatic reconnection… (error: Connection reset)”.
Our deployment was done using kubernetes. Any other suggestion since we get the same exception as with 3.0.23?

Thanks, Alin

Hi, I don`t know that how to config the orientdb connection. Orietndb connect server with session. And It will expire after some time . if you have a connection, and close it after a long time , and the connection will be expired. I think you should connect orientdb server with db pool.

Thanks ,52HZ

发送自 Windows 10 版邮件应用