-
Notifications
You must be signed in to change notification settings - Fork 522
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
fix: tinkerpop unit test #2381
base: master
Are you sure you want to change the base?
fix: tinkerpop unit test #2381
Conversation
2476cd3
to
60cfcb2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Currently only 1 failed test found: @javeme any idea about it? Error: Failures:
Error: EventStrategyProcessTest.shouldTriggerAddVertexWithPropertyThenPropertyAdded:215 expected:<1> but was:<0>
shouldTriggerAddVertexWithPropertyThenPropertyAdded(org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest) Time elapsed: 1.461 s <<< FAILURE!
java.lang.AssertionError: expected:<1> but was:<0>
at org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddVertexWithPropertyThenPropertyAdded(EventStrategyProcessTest.java:215) |
rocksdb 单测问题,看着是我们 rocksdb 不太稳定 |
hbase 有一个单测试是这个问题,close 的时候,有事务没 close,这个貌似以前讨论过 |
000e312
to
de52e33
Compare
我加了一点debug信息了,可以根据错误日志一起再看看问题 |
d92093c
to
1943b7c
Compare
eaeb7ed
to
a7dce87
Compare
debug 日志如下:看这些日志,close 抛异常,似乎是符合预期的 Error: -14 07:21:46 [main] [ERROR] o.a.h.StandardHugeGraph - Tx '40' is not closed in thread
java.lang.Exception: null
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.setOpened(StandardHugeGraph.java:1457) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1402) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:213) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:210) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.doReadWrite(AbstractThreadLocalTransaction.java:92) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.readWrite(AbstractTransaction.java:136) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.hugegraph.StandardHugeGraph.graphTransaction(StandardHugeGraph.java:541) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph.vertices(StandardHugeGraph.java:685) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraph.vertices(TestGraph.java:215) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.TransactionTest$3.run(TransactionTest.java:506) ~[gremlin-test-3.5.1.jar:3.5.1]
Error: -14 07:21:46 [main] [ERROR] o.a.h.t.TestGraphProvider - Error while closing graph 'standardhugegraph[hugegraph_structure_g1]'
java.lang.IllegalStateException: Ensure tx closed in all threads when closing graph 'hugegraph_structure_g1'
at com.google.common.base.Preconditions.checkState(Preconditions.java:532) ~[guava-30.0-jre.jar:?]
at org.apache.hugegraph.util.E.checkState(E.java:64) ~[hugegraph-common-1.2.0.jar:1.2.0]
at org.apache.hugegraph.StandardHugeGraph.close(StandardHugeGraph.java:985) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraph.close(TestGraph.java:232) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraphProvider.clear(TestGraphProvider.java:361) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.StructureBasicSuite$1.evaluate(StructureBasicSuite.java:115) ~[classes/:?]
at org.apache.tinkerpop.gremlin.AbstractGremlinSuite$1.evaluate(AbstractGremlinSuite.java:235) ~[gremlin-test-3.5.1.jar:3.5.1]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.1.jar:4.13.1]
at org.junit.runners.ParentRunner.run(ParentRunner.java:413) ~[junit-4.13.1.jar:4.13.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386) ~[surefire-booter-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323) ~[surefire-booter-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143) ~[surefire-booter-2.20.jar:2.20]
2023-12-14 07:21:46 [main] [INFO] o.a.h.StandardHugeGraph - Close graph standardhugegraph[hugegraph_structure_standard]
2023-12-14 07:21:46 [main] [INFO] o.a.h.t.ServerInfoManager - Remove server info: server-tinkerpop
Error: -14 07:21:46 [main] [ERROR] o.a.h.StandardHugeGraph - Tx '48' is not closed in thread
java.lang.Exception: null
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.setOpened(StandardHugeGraph.java:1457) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1402) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:213) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:210) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.doReadWrite(AbstractThreadLocalTransaction.java:92) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.readWrite(AbstractTransaction.java:136) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.hugegraph.StandardHugeGraph.graphTransaction(StandardHugeGraph.java:541) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph.vertices(StandardHugeGraph.java:685) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraph.vertices(TestGraph.java:215) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.TransactionTest$4.run(TransactionTest.java:545) ~[gremlin-test-3.5.1.jar:3.5.1]
Error: -14 07:21:46 [main] [ERROR] o.a.h.StandardHugeGraph - Tx '40' is not closed in thread
java.lang.Exception: null
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.setOpened(StandardHugeGraph.java:1457) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1402) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:213) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:210) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.doReadWrite(AbstractThreadLocalTransaction.java:92) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.readWrite(AbstractTransaction.java:136) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.hugegraph.StandardHugeGraph.graphTransaction(StandardHugeGraph.java:541) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph.vertices(StandardHugeGraph.java:685) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraph.vertices(TestGraph.java:215) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.TransactionTest$3.run(TransactionTest.java:503) ~[gremlin-test-3.5.1.jar:3.5.1]
Error: -14 07:21:46 [main] [ERROR] o.a.h.StandardHugeGraph - Tx '51' is not closed in thread
java.lang.Exception: null
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.setOpened(StandardHugeGraph.java:1457) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1402) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.TransactionTest.lambda$shouldAllowReferenceOfVertexIdOutsideOfOriginalThreadManual$10(TransactionTest.java:827) ~[gremlin-test-3.5.1.jar:3.5.1]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_392]
Error: -14 07:21:46 [main] [ERROR] o.a.h.StandardHugeGraph - Tx '43' is not closed in thread
java.lang.Exception: null
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.setOpened(StandardHugeGraph.java:1457) ~[classes/:?]
at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1402) ~[classes/:?]
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95) ~[gremlin-core-3.5.1.jar:3.5.1]
at org.apache.tinkerpop.gremlin.structure.TransactionTest.lambda$shouldAllowReferenceOfEdgeIdOutsideOfOriginalThreadManual$11(TransactionTest.java:850) ~[gremlin-test-3.5.1.jar:3.5.1]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_392]
Error: -14 07:21:46 [main] [ERROR] o.a.h.t.TestGraphProvider - Error while closing graph 'standardhugegraph[hugegraph_structure_standard]'
java.lang.IllegalStateException: Ensure tx closed in all threads when closing graph 'hugegraph_structure_standard'
at com.google.common.base.Preconditions.checkState(Preconditions.java:532) ~[guava-30.0-jre.jar:?]
at org.apache.hugegraph.util.E.checkState(E.java:64) ~[hugegraph-common-1.2.0.jar:1.2.0]
at org.apache.hugegraph.StandardHugeGraph.close(StandardHugeGraph.java:985) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraph.close(TestGraph.java:232) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.TestGraphProvider.clear(TestGraphProvider.java:361) ~[classes/:?]
at org.apache.hugegraph.tinkerpop.StructureBasicSuite$1.evaluate(StructureBasicSuite.java:115) ~[classes/:?]
at org.apache.tinkerpop.gremlin.AbstractGremlinSuite$1.evaluate(AbstractGremlinSuite.java:235) ~[gremlin-test-3.5.1.jar:3.5.1]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.1.jar:4.13.1]
at org.junit.runners.ParentRunner.run(ParentRunner.java:413) ~[junit-4.13.1.jar:4.13.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) ~[surefire-junit4-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386) ~[surefire-booter-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323) ~[surefire-booter-2.20.jar:2.20]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143) ~[surefire-booter-2.20.jar:2.20] |
78117cb
to
5238b07
Compare
也就 CommunityGeneratorTest 这个测试,把这个注释了,其他的貌似就能正常跑了 |
could be reproduced in local env: (with same problem) @javeme seems it failed for a long time (due to the `open RocksDB multi times?) Any known context about it? |
bd98528
to
c0e05d0
Compare
I can't run the core test and tinkerpop test locally(unit test is ok), since this commit was introduced: |
That PR only added a layer of directory structure without making any code level changes, should it be a problem of relative/abs path or environment variable changes? How does the TP test run in Eclipse? (maybe need update the working space?) |
28c3435
to
8f84e08
Compare
2ced75a
to
57ab5fa
Compare
23a49f3
to
20704bb
Compare
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java
Outdated
Show resolved
Hide resolved
...h-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStoreProvider.java
Outdated
Show resolved
Hide resolved
@@ -94,6 +94,7 @@ org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest.shouldCo | |||
# unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddEdge: Unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddEdgeByPath: Unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddVertexWithPropertyThenPropertyAdded: Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some comments for why
} catch (Throwable ignore) { | ||
return; | ||
} | ||
((RocksDBStdSessions)this.sessions).forceClose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may the rocksdb instance be shared by other graph instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now, if the rocksdb instance be shard with other graph instance, the rocksdb will throw exception, now, different graph have different rocksdb instance
3afbe22
to
ab08eee
Compare
@@ -1331,6 +1332,11 @@ public TinkerPopTransaction(Graph graph) { | |||
this.transactions = ThreadLocal.withInitial(() -> null); | |||
} | |||
|
|||
public String txThreadKey() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused code?
@@ -94,6 +94,7 @@ org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest.shouldCo | |||
# unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddEdge: Unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddEdgeByPath: Unsupported automatic edge id, therefore number of edge is wrong | |||
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest.shouldTriggerAddVertexWithPropertyThenPropertyAdded: Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some comments like this:
# unsupported automatic edge id, therefore number of edge is wrong
} catch (Throwable ignore) { | ||
return; | ||
} | ||
((RocksDBStdSessions)this.sessions).forceClose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
but we still need to iterate this.sessions() and close every session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, now, this way close the session first, last forceClose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note also need to iterate this.sessions() and forceClose every session.
@Test
public void testOpenGraph() throws Exception {
List<HugeGraph> graphs = openGraphs("test_g1");
final HugeGraph graph = graphs.get(0);
graph.initBackend();
CountDownLatch count = new CountDownLatch(1);
new Thread(()-> {
graph.vertices();
graph.tx().rollback();
count.countDown();
}).start();
count.await();
graph.close();
graphs = openGraphs("test_g1");
HugeGraph graph1 = graphs.get(0);
graph1.initBackend();
graph1.vertices();
} 这个单测可以复线rocksdb 打开的错误,在 setClose 的时候 ref==0 就destoryTransaction 或者 graph.close 的时候或者 forceClose,可以通过 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the root cause is destroyTransaction()
can't get Txs of others threads, so the destroy opportunity is missed when graph.close()/closeTx()
.
We can try to close all the thread-local Txs when destroyTransaction()
, even though there are some risks of cross-thread operations (such as can't release underlying thread-local bound resources), add a TODO mark to find a more perfect method.
Note setClosed()
just set flag opened=false
to reuse the backend tx, so can't destory Txs:
Line 1439 in 7635c67
// Just set flag opened=false to reuse the backend tx |
} catch (Throwable ignore) { | ||
return; | ||
} | ||
((RocksDBStdSessions)this.sessions).forceClose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note also need to iterate this.sessions() and forceClose every session.
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
No description provided.