Re: throw NullPointerException when query with hasLabel() script


阳生丙 <ouyang....@...>
 

it is reproducible in my environment. and this problem is not appeared when janusgraph server started. 

it is always there after i running into it for the first time, continuing to now

i have another server running, but there is no this probelm.

what informations do you want me to provide? the only log messages while i submit above gremlin script are posted above.


在2020年11月30日星期一 UTC+8 下午6:52:31<HadoopMarc> 写道:

Hi,

Can you please send something going wrong that is reproducible? Below you find an example on the latest janusgraph-full-0.5.2 where hasLabel() works fine.

marc:/tera/lib/janusgraph-full-0.5.2$ bin/janusgraph.sh start
Forking Cassandra...
Running `nodetool statusthrift`..... OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9200)........ OK (connected to 127.0.0.1:9200).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182)...... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.

marc:/tera/lib/janusgraph-full-0.5.2$ bin/gremlin.sh

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
gremlin> g = traversal().withRemote(DriverRemoteConnection.using("localhost",8182,"g"))
==>graphtraversalsource[emptygraph[empty], standard]
gremlin> g.V().elementMap()
==>[id:4320,label:monster,name:cerberus]
==>[id:8320,label:demigod,name:hercules,age:30]
==>[id:16632,label:god,name:pluto,age:4000]
==>[id:4272,label:titan,name:saturn,age:10000]
==>[id:8368,label:location,name:sea]
==>[id:4200,label:monster,name:nemean]
==>[id:20728,label:monster,name:hydra]
==>[id:24824,label:location,name:tartarus]
==>[id:8440,label:god,name:neptune,age:4500]
==>[id:4224,label:god,name:jupiter,age:5000]
==>[id:12536,label:human,name:alcmene,age:45]
==>[id:4344,label:location,name:sky]
gremlin> g.V().hasLabel('monster').elementMap()
==>[id:4320,label:monster,name:cerberus]
==>[id:4200,label:monster,name:nemean]
==>[id:20728,label:monster,name:hydra]
gremlin> g.V().hasLabel('monster').has('name', 'cerberus').elementMap()
==>[id:4320,label:monster,name:cerberus]
gremlin>


Best wishes,    Marc

Op maandag 30 november 2020 om 08:52:34 UTC+1 schreef ouy...@...:
to HadoopMarc:

it is not about double quote. the problem is: when gremlin script contains hasLabel() clause, janus server will throws NullPointerException.

i use console and gremlin driver to fire these query to remote janusgraph server.



在2020年11月28日星期六 UTC+8 上午2:48:23<HadoopMarc> 写道:
Hi,

Do you mean that the only difference  between the first and the second script is the presence of the closing double quote? I see the stacktrace is from Gremlin Server: did you use Gremlin Console to fire the query? What happens if you make a GLV/bytecode connection instead of a connection for groovy scripts, that is using:

g = traversal().withRemote(DriverRemoteConnection.using("localhost",8182,"g"))

Best wishes,    Marc

Op vrijdag 27 november 2020 om 19:05:24 UTC+1 schreef ouy...@...:
query with gremlin script:  "g.E().hasLabel('L2_LINK').has('prop1', 'prop1-value')"
the returned result is expected and correct.

but query with gremlin script: "g.E().hasLabel('L2_LINK').has('prop1', 'prop1-value')

throws NullPointerException.

the exception stack info is as follow:

2020-11-27 12:07:35,227 WARN  [gremlin-server-exec-10] AbstractEvalOpProcessor.java:311 - Exception processing a script on request [RequestMessage{, requestId=cb1f0ab6-cee6-47c4-bbc1-196f27b1b14c, op='eval', processor='', args={gremlin=g.E().hasLabel('L2_LINK').has('prop1', 'prop1-value'), batchSize=64}}].
java.lang.NullPointerException
        at org.janusgraph.graphdb.util.ElementHelper.getValues(ElementHelper.java:41)
        at org.janusgraph.graphdb.query.condition.PredicateCondition.evaluate(PredicateCondition.java:68)
        at org.janusgraph.graphdb.query.condition.And.evaluate(And.java:55)
        at org.janusgraph.graphdb.query.graph.GraphCentricQuery.matches(GraphCentricQuery.java:153)
        at org.janusgraph.graphdb.query.QueryProcessor.lambda$getFilterIterator$2(QueryProcessor.java:133)
        at com.google.common.collect.Iterators$7.computeNext(Iterators.java:652)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at org.janusgraph.graphdb.query.ResultSetIterator.nextInternal(ResultSetIterator.java:54)
        at org.janusgraph.graphdb.query.ResultSetIterator.next(ResultSetIterator.java:67)
        at org.janusgraph.graphdb.query.ResultSetIterator.next(ResultSetIterator.java:28)
        at com.google.common.collect.Iterators$7.computeNext(Iterators.java:651)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at com.google.common.collect.Iterators$5.hasNext(Iterators.java:547)
        at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1811)
        at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
        at org.janusgraph.graphdb.util.MultiDistinctOrderedIterator.hasNext(MultiDistinctOrderedIterator.java:75)
        at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:149)
        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:197)
        at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:146)
        at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:264)
        at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)


and the problem is reproducible,  is it a bug?

enviroment:
janusgraph version: 0.5.2
backend cassandra version: 3.11


Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.