orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Result sets not closing in 3.0.1?

Open leonwang0 opened this issue 6 years ago • 22 comments

OrientDB Version: 3.0.1

Java Version: 1.8.0_131

OS: CentOS release 6.6 (Final)

Expected behavior

Is it possible OResultSets in 3.0.1 aren't always released when you call .close()? I believe I am calling it on every result set created, yet am still blowing up:

Actual behavior

2018-05-22 16:02:30:765 WARNI {db=sna_new} This database instance has 244850 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:766 WARNI {db=sna_new} This database instance has 262530 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:766 WARNI {db=sna_new} This database instance has 229410 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:766 WARNI {db=sna_new} This database instance has 266900 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 234910 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 220480 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 247970 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 256160 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 244250 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:767 WARNI {db=sna_new} This database instance has 247840 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:768 WARNI {db=sna_new} This database instance has 248810 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:768 WARNI {db=sna_new} This database instance has 251840 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:768 WARNI {db=sna_new} This database instance has 250910 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:769 WARNI {db=sna_new} This database instance has 261970 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:30:769 WARNI {db=sna_new} This database instance has 254890 open command/query result sets, please make sure you close them with OResultSet.close() 2018-05-22 16:02:59:447 WARNI {db=sna_new} This database instance has 252990 open command/query result sets, please make sure you close them with OResultSet.close()^C

Steps to reproduce

leonwang0 avatar May 22 '18 08:05 leonwang0

Hi @leonwang0

Yes, all the result sets are released when you execute .close(). This could be a bug, or just a query you forgot to close. Do you have a test case to reproduce the problem?

Thanks

Luigi

luigidellaquila avatar May 22 '18 09:05 luigidellaquila

I have the same problem. I am using OrientDB with Tinkerpop Gremlin. I am interested how can I close resultset in traversal?

My queries look like these:

g.V().has(label, "code", code).limit(1).next();
g.V().hasLabel(label)
                        .where(__.in("route").count().is(P.eq(0))).next();

I think there is nothing to close here.

asadganiev avatar Jun 06 '18 13:06 asadganiev

Hi @asadganiev

are you running the queries against the GremlinServer?

Thanks

wolf4ood avatar Jun 06 '18 15:06 wolf4ood

Hi @maggiolo00

No. against OrientDB in maven project. Here are project dependencies:

<dependencies>
    <dependency>
        <groupId>com.orientechnologies</groupId>
        <artifactId>orientdb-core</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>com.orientechnologies</groupId>
        <artifactId>orientdb-graphdb</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-core</artifactId>
        <version>3.3.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>tinkergraph-gremlin</artifactId>
        <version>3.3.3</version>
    </dependency>
    <dependency>
        <groupId>com.orientechnologies</groupId>
        <artifactId>orientdb-gremlin</artifactId>
        <version>3.0.1</version>
    </dependency>
</dependencies>

OrientGraph graph = OrientGraph.open("plocal:" + someDir); GraphTraversalSource g = graph.traversal();

asadganiev avatar Jun 06 '18 15:06 asadganiev

I also have this problem on OrientDB 3.0.2 but i must admit i've never seen anywhere that we had to manually close those ResultSet before.

CyprienGottstein avatar Jun 06 '18 15:06 CyprienGottstein

@CyprienGottstein

Are you using Gremlin API too?

asadganiev avatar Jun 06 '18 15:06 asadganiev

@asadganiev

No, i'm only using the java Graph API :s

CyprienGottstein avatar Jun 06 '18 15:06 CyprienGottstein

@tglman

Thanks, but how can I include it to my maven project dependencies?

asadganiev avatar Jun 06 '18 17:06 asadganiev

Hi @asadganiev,

This was a fix for a specific case when the result set is empty, i would definitely suggest to double check your cond for missing close, this patch will be released with 3.0.3, you can get a snapshot from here: https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-community/3.0.3-SNAPSHOT/

Regards

tglman avatar Jun 07 '18 10:06 tglman

@tglman

I have added these two amended classes (ODatabaseDocumentAbstract, OLocalResultSetLifecycleDecorator) from this commit e6de82f manually to my project for checking if it is really solves the problem. But unfortunately the issue still exists.

Later on I am going to create a gist to show a real example of code, so that you can have detailed information.

Best regards, Asad

asadganiev avatar Jun 10 '18 06:06 asadganiev

@tglman @luigidellaquila

I have created repository ODB-8282 in github. You may check why this issue occurring in my code.

If you have any question please write me.

Best regards, Asad

asadganiev avatar Jun 12 '18 18:06 asadganiev

Hi @asadganiev,

Yes there was an additional issue in gremlin, that i just fixedm anyway i'm afraid that the code you are using should change, here is an example:

  public static OperationImpl getLastOperation(GraphTraversalSource g) {
    Vertex vertex = null;
    try (Traversal<Vertex, Vertex> traversal = g.V().hasLabel("operation").where(__.out("linked").count().is(P.eq(0)))) {
      vertex = traversal.next();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return OperationImpl.valueOf(vertex);
  }

to be able to close the underling reuslt set the traversal should be closed as well.

Regards

tglman avatar Jun 13 '18 15:06 tglman

Hi @tglman

Thanks very much. I was really wondering how to close traversal. By the way I have a question. Does all APIs (Graph API, Document API, Object API etc) talks with OrientDB via SQL?

Best regards

asadganiev avatar Jun 13 '18 16:06 asadganiev

Hi @asadganiev,

we use a lot of sql in the main engine, but not only, I direct load of a record, the save, the commit of transaction, have direct call in the protocol with specific messages. In terms of API all bind to the Document API that has most of the logic inside.

Regards

tglman avatar Jun 14 '18 09:06 tglman

Hi @tglman,

Let me explain why I have asked this question and how I came to OrientDB or even to Graph databases.

First I have used Neo4J. It was very slow in insertion. Then found out about OrientDB, it was fast enough in insertion. But..

As a java developer firstly I chose Graph API. But it was not so easy in using. I was using Tinkerpop Blueprints, but in github it is shown as deprecated. Then I switched to Tinkerpop3 Gremlin. I liked it very much. Unfortunately there were some issues. Result set is not closed in Gremlin, and by the way why I can't set property type in Gremlin? It is storing long as a String, and is hanging while searching. Gremlin handles small database, but when I work with more than 10 million rows it hangs catastrophically.

So now I decided to work with old known pure SQL through JDBC.

asadganiev avatar Jun 14 '18 10:06 asadganiev

Hi @asadganiev,

Yes we are aware of some limitations on the gremlin side and we are working as well with upstream to evolve it to be faster. SQL is a fine choice, i would suggest as well to check the Multi Model API : https://www.orientdb.com/docs/last/java/Java-MultiModel-API.html.

Can we close this issue ?

Regards

tglman avatar Jul 05 '18 10:07 tglman

Hi @tglman

Thanks for information, but I think you have some error in your SSL. When tried to open the https://www.orientdb.com/docs/last/java/Java-MultiModel-API.html Safari is showing this:

screen shot 2018-07-05 at 3 56 12 pm

asadganiev avatar Jul 05 '18 10:07 asadganiev

hi @asadganiev,

Thank you we are checking that.

Regards

tglman avatar Jul 05 '18 13:07 tglman

Hi @tglman

Can we close this issue ?

Unfortunately the issue still exists, I have tested it with version 3.0.2 and 3.0.3 as well in ODB-8282.

Best regards, Asad

asadganiev avatar Jul 06 '18 03:07 asadganiev

This error still appears on version 3.0.28, 3.0.31 when calling the wrong function parameter

quanghaisoft avatar May 14 '20 02:05 quanghaisoft

Hi, I'm still seeing this issue in 3.1.12! @Laa, Please re-open this!

pontusvision avatar Oct 16 '21 16:10 pontusvision

Hi,

Do you still see this problem in recent version ? Consider also that this warning can happen if you forget to close the result set yourself.

tglman avatar Jan 08 '24 12:01 tglman