Skip to content
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: Traversal.graph is empty in StepStrategy.apply() with count().is(0) #1903

Merged
merged 2 commits into from
Jul 1, 2022

Conversation

javeme
Copy link
Contributor

@javeme javeme commented Jun 13, 2022

This PR is a workaround solution for apache/tinkerpop#1699

related issue: #1900

…s(0)`

Change-Id: I0ca670a1df852504dcc8e8d0cfd8c0de39987e60
@javeme
Copy link
Contributor Author

javeme commented Jun 13, 2022

The following is the stack trace when traversal.getGraph().get() returned null:

2022-06-13 23:18:00 [gremlin-server-exec-2] [WARN] o.a.t.g.s.h.HttpHandlerUtil - Invalid request - responding with 500 Internal Server Error and Error encountered evaluating script: g.V(3).repeat(inE('child').outV().simplePath()).until(or(inE().count().is(0),loops().is(eq(2)))).path()
java.lang.NullPointerException: null
	at com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy.apply(HugeVertexStepStrategy.java:73) ~[classes/:?]
	at com.baidu.hugegraph.auth.HugeGraphAuthProxy$TraversalStrategyProxy.apply(HugeGraphAuthProxy.java:1722) ~[classes/:?]
	at org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper.applyTraversalRecursively(TraversalHelper.java:467) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper.applyTraversalRecursively(TraversalHelper.java:475) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper.applyTraversalRecursively(TraversalHelper.java:475) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper.applyTraversalRecursively(TraversalHelper.java:475) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.applyStrategies(DefaultTraversal.java:151) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:221) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.fill(IteratorUtils.java:62) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.list(IteratorUtils.java:85) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.asList(IteratorUtils.java:382) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.lambda$channelRead$1(HttpGremlinEndpointHandler.java:221) ~[gremlin-server-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.util.function.FunctionUtils.lambda$wrapFunction$0(FunctionUtils.java:36) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278) ~[gremlin-groovy-3.5.1.jar:3.5.1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_111]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
	at com.baidu.hugegraph.auth.HugeGraphAuthProxy$ContextTask.run(HugeGraphAuthProxy.java:1838) [classes/:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #1903 (64f0300) into master (2af01bc) will decrease coverage by 0.63%.
The diff coverage is 78.94%.

@@             Coverage Diff              @@
##             master    #1903      +/-   ##
============================================
- Coverage     71.11%   70.47%   -0.64%     
+ Complexity      963      710     -253     
============================================
  Files           452      452              
  Lines         38405    38787     +382     
  Branches       5418     5531     +113     
============================================
+ Hits          27312    27337      +25     
- Misses         8436     8771     +335     
- Partials       2657     2679      +22     
Impacted Files Coverage Δ
...a/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java 57.20% <50.00%> (ø)
...du/hugegraph/traversal/optimize/TraversalUtil.java 62.68% <66.66%> (+0.13%) ⬆️
...aph/traversal/optimize/HugeVertexStepStrategy.java 97.56% <100.00%> (+0.12%) ⬆️
...baidu/hugegraph/backend/store/raft/RaftResult.java 81.25% <0.00%> (-18.75%) ⬇️
...aidu/hugegraph/backend/store/raft/RaftClosure.java 44.82% <0.00%> (-17.25%) ⬇️
...ackend/store/cassandra/CassandraEntryIterator.java 73.91% <0.00%> (-10.15%) ⬇️
...hugegraph/backend/store/raft/RaftBackendStore.java 75.26% <0.00%> (-6.46%) ⬇️
.../hugegraph/backend/store/BackendEntryIterator.java 61.53% <0.00%> (-2.57%) ⬇️
...va/com/baidu/hugegraph/task/ServerInfoManager.java 76.16% <0.00%> (-1.17%) ⬇️
...raph/backend/store/rocksdb/RocksDBStdSessions.java 75.64% <0.00%> (-1.00%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2af01bc...64f0300. Read the comment docs.

Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a gremlin test for it?

@javeme
Copy link
Contributor Author

javeme commented Jun 14, 2022

Yes, I will add a test case

Change-Id: Ifd20c613f6ff63ac9e7609347fb4b770740367de
@coderzc coderzc merged commit a1055fe into master Jul 1, 2022
@coderzc coderzc deleted the count-is-0-apply-graph-missing branch July 1, 2022 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants