JanusGraph / JanusGraph/janusgraph

Subgraph() step not working via GraphBinary

Open
#2,969 1 comment 5 reactions 0 assignees View on GitHub
area/tinkerpop kind/bug/possible
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

The `subgraph()` step returns a [`Graph` instance via GraphBinary](https://tinkerpop.apache.org/docs/current/dev/io/#_graph). This however results in an exception for JanusGraph (see stack trace below).

I first found this with our productive setup which uses CQL + ES, but could also reproduce it with the vanilla Docker image using Berkeleyje + Lucene by just adding two vertices and an edge between them and then executing the traversal (see _steps to reproduce_).

While this sounds similar to #2843, I think that it's a different issue because there the problem is that no serializer for the type can be found. With GraphBinary here we're getting a completely different exception and the stack trace already shows that the correct serializer for the `graph` type was used: `GraphSerializer`.

For confirmed bugs, please report:
- Version: 0.6.1
- Storage Backend: berkeleyje / cql
- Mixed Index Backend: lucene / elasticsearch
- Link to discussed bug:
- Expected Behavior: The subgraph should be returned to the client.
- Current Behavior: See the exception below.
- Steps to Reproduce: Configure GraphBinary in the client and execute a traversal that returns a graph, e.g,, `g.E().subgraph('sg').cap('sg').next()`.

### Stack Trace (if you have one)

```
org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - The result [[tinkergraph[vertices:2 edges:1]]] in the request 80f14092-8ace-410b-bde9-46d4bd857f3b could not be serialized and returned.
java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:492)
at org.janusgraph.graphdb.relations.RelationIdentifier.getInVertexId(RelationIdentifier.java:63)
at org.janusgraph.graphdb.tinkerpop.io.binary.RelationIdentifierGraphBinarySerializer.writeNonNullableValue(RelationIdentifierGraphBinarySerializer.java:43)
at org.janusgraph.graphdb.tinkerpop.io.binary.RelationIdentifierGraphBinarySerializer.writeNonNullableValue(RelationIdentifierGraphBinarySerializer.java:24)
at org.janusgraph.graphdb.tinkerpop.io.binary.JanusGraphTypeSerializer.writeValue(JanusGraphTypeSerializer.java:89)
at org.janusgraph.graphdb.tinkerpop.io.binary.JanusGraphTypeSerializer.write(JanusGraphTypeSerializer.java:72)
at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:98)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.GraphSerializer.writeVertex(GraphSerializer.java:138)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.GraphSerializer.writeValue(GraphSerializer.java:120)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.GraphSerializer.writeValue(GraphSerializer.java:45)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73)
at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.CollectionSerializer.writeValue(CollectionSerializer.java:52)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:44)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:29)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91)
at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73)
at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112)
at org.apache.tinkerpop.gremlin.driver.ser.binary.ResponseMessageSerializer.writeValue(ResponseMessageSerializer.java:84)
at org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1.serializeResponseAsBinary(GraphBinaryMessageSerializerV1.java:150)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.makeFrame(AbstractOpProcessor.java:291)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:167)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:263)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:283)
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)
```

Contributor guide

Open the contributing guide

Research direction

Start with RelationIdentifierGraphBinarySerializer and the RelationIdentifier stack-trace path, then compare how GraphSerializer writes vertices from the subgraph result. Reproduce with GraphBinary using g.E().subgraph('sg').cap('sg').next() and two vertices plus an edge; done means the subgraph is returned to the client without the serialization exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.