Open cvsekhar opened 6 years ago
Figured out if I use the shaded tinkerpop jackson annotations , its working. Some how by placing the jackson libraries as suggested in the Wiki doesn't work. We need to create a folder also called lib and plugin and place bitsy jar file init.
Hi Sekhar,
Thanks for reporting the issue.
Can you describe your setup in a little more detail? I don't see "com.lambdazen.bitsy" in the stack-track, which probably indicates that this is a serialization issue that has to do with Gremlin trying to serialize the graph. Are you using GraphSON to write the graph down? I can investigate more if you can share the code/use-case with a gist or something...
Also, if you have already resolved the issue, how do you suggest we update our Wiki to make sure it doesn't happen again?
Regards,
Sridhar.
Hi Sridhar,
I was trying to use bitsy(Memory mode) inside the gremlin-server as a graph cache(only reads no writes) and using the rest api.
During starting the server as a start was loading my objects using the load-bitsy-groovy scripts, i was loading the objects to bitsy using BitsyGraph, opening a transaction and using addVertex and addEdge.
the only change I made was converted all references of jackson to tinkerpop.shaded.jackson as the fastxml.jackson anotations are somehow not getting used even if we have all the jackson*.jar files.
After make those changes, and made sure it can have all the objects in memory as I don't want them to be persisted to file system. I was able to get the results from the rest api. The circular error is gone.
Please let me know what is the right approach
Attached the screenshot from the gremlin server.
Attaching one of the files I have changed. (I might be missing, if I use tinkerpop imports its working)
Thanks for the info.
The jackson JARs are missing in the ext/bitsy/ folder -- https://github.com/lambdazen/bitsy/wiki#using-bitsy-in-gremlin-console-with-gremlin-server -- did you already try putting them in and then removed them out because of the circular reference error?
Also, just to confirm: Are you using launching the Gremlin server with this file? https://github.com/lambdazen/bitsy/blob/master/src/test/resources/gremlin-server/gremlin-server-bitsy.yaml
There is a mention of "com.lambdazen.bitsy.BitsyIoRegistryV3d0" which is supposed to handle the Kryo serialization.
I still don't get why Jackson is conflicting though... Bitsy uses Jackson to load/store data into the file-system. I don't understand what invokes the GraphSONMessageSerializerV3d0 in the stack trace, or why Gremlin needs to serialize/deserialize Bitsy objects into JSON format.
Do you know what is in the load-bitsy.groovy script?
Regards,
Sridhar.
Jackson JAR's: I have removed jackson jars as they were not being used.
Gremlin Server yaml: yes, I have used your gremlin yaml file
load-bitsy.groovy We have already defined vertex and edges with id's. so I have used the following code to load the MemoryGraph. Here is a snippet groovy script for vertex and edge is analagous. since I have handle to the graph in the script. I was loading the objects through the script. The UUID class is also the one I was using from bitsy.
def jsonToBitsyVertex = { Map m, BitsyTransaction tx, String vertexcollectionId ->
String uuid = m."id"
String entityType = m."vertexType"
//remove the keys and label
m.remove("_key")
m.remove("vertexType")
m.remove("id")
m['vertexcollectionId'] = vertexcollectionId
if(uuid != null){
BitsyVertex vertex = new BitsyVertex(
UUID.fromString(uuid),
entityType,
DictionaryFactory.fromMap(m),
tx,
BitsyState.M,
0)
tx.addVertex(vertex)
}
}
def loadVerticies = { BitsyGraph graph, String fileName, String vertexcollectionId ->
def jsonSlurper = new JsonSlurper()
def read = new BufferedReader(new InputStreamReader(
new FileInputStream(fileName)))
data = jsonSlurper.parse(read)
try {
BitsyTransaction tx = graph.tx()
for (Map m : data) {
jsonToBitsyVertex(m, tx, vertexcollectionId)
}
tx.commit()
}
catch (Exception e){
e.printStackTrace()
}
}
I get the same error message, with a very simple query :
Error during serialization: Direct self-reference leading to cycle (through reference chain: com.lambdazen.bitsy.store.VertexBean["id"])
The query is
g.V().id()
In the mean time, do Bitsy accept external ids when loading them ? Or does it assign them itself ?
Hi dseguy,
How are you using the bitsy inside a gremlin server?
you can use your own id but make sure that id is converted to the bitsy UUID like UUID.fromString(uuid)
see my snippet above, i use my own ids and convert them to bisty UUID
I'm running gremlin queries via the Websockets and the groovy language.
I'll try the UUID.fromString(uuid).
@dseguy , you need to compile the bitsy jar as I have done, you need to replace all the imports related to jackson with org.apache.tinkerpop.shaded.jackson.* and compile the jar and place them as I have listed couple of comments above.
gremlin_query =g.V().hasLabel('toy').outE().inV().path().limit(1)
Direct self-reference leading to cycle (through reference chain: com.lambdazen.bitsy.store.VertexBean[\"id\"])
org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException: Direct self-reference leading to cycle (through reference chain: com.lambdazen.bitsy.store.VertexBean[\"id\"])\n\tat org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException.from(JsonMappingException.java:284)\n\tat org.apache.tinkerpop.shaded.jackson.databind.SerializerProvider.mappingException(SerializerProvider.java:1110)\n\tat org.apache.tinkerpop.shaded.jackson.databind.SerializerProvider.reportMappingProblem(SerializerProvider.java:1135)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.BeanPropertyWriter._handleSelfReference(BeanPropertyWriter.java:921)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:698)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:581)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2493)\n\tat org.apache.tinkerpop.shaded.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)\n\tat org.apache.tinkerpop.shaded.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:1662)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONSerializersV3d0$VertexJacksonSerializer.serialize(GraphSONSerializersV3d0.java:102)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONSerializersV3d0$VertexJacksonSerializer.serialize(GraphSONSerializersV3d0.java:88)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdScalarSerializer.serializeWithType(StdScalarSerializer.java:43)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2493)\n\tat org.apache.tinkerpop.shaded.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serialize(JavaUtilSerializersV3d0.java:127)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serializeWithType(JavaUtilSerializersV3d0.java:135)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serializeWithType(JavaUtilSerializersV3d0.java:118)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2493)\n\tat org.apache.tinkerpop.shaded.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)\n\tat org.apache.tinkerpop.shaded.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:1662)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONSerializersV3d0$PathJacksonSerializer.serialize(GraphSONSerializersV3d0.java:264)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONSerializersV3d0$PathJacksonSerializer.serialize(GraphSONSerializersV3d0.java:250)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdScalarSerializer.serializeWithType(StdScalarSerializer.java:43)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2493)\n\tat org.apache.tinkerpop.shaded.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serialize(JavaUtilSerializersV3d0.java:127)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serializeWithType(JavaUtilSerializersV3d0.java:135)\n\tat org.apache.tinkerpop.gremlin.structure.io.graphson.JavaUtilSerializersV3d0$ListJacksonSerializer.serializeWithType(JavaUtilSerializersV3d0.java:118)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0$ResponseMessageSerializer.ser(AbstractGraphSONMessageSerializerV2d0.java:276)\n\tat org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0$ResponseMessageSerializer.serializeWithType(AbstractGraphSONMessageSerializerV2d0.java:250)\n\tat org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV2d0$ResponseMessageSerializer.serializeWithType(AbstractGraphSONMessageSerializerV2d0.java:235)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.impl.TypeWrappedSerializer.serialize(TypeWrappedSerializer.java:32)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3681)\n\tat org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3057)\n\tat org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0.serializeResponseAsString(GraphSONMessageSerializerV3d0.java:89)\n\tat org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.lambda$channelRead$1(HttpGremlinEndpointHandler.java:256)\n\tat org.apache.tinkerpop.gremlin.util.function.FunctionUtils.lambda$wrapFunction$0(FunctionUtils.java:36)\n\tat org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:268)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n"