[ 
https://issues.apache.org/jira/browse/TINKERPOP-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15199897#comment-15199897
 ] 

Dylan Millikin commented on TINKERPOP-732:
------------------------------------------

Ok so everything works except for {{GraphSONMessageSerializerGremlinV1d0}}. And 
to be more specific, serialization works but deserialization doesn't. 

The reason behind this is because the format expected in deserializing these 
messages is as follows:

{code}
{"property": vp[name->marko]}
{code}
turns to the following JSON:
{code}
{
   "@class" : "java.lang.HashMap",
   "property": {
      "@class": "org.apache.tinkerpop.gremlin.structure.VertexProperty",
      "id": 0,
      "label": "name",
      "value": "marko"
   }
}
{code}

The deserializing process knows to just create the object {{@class}} and give 
it the set properties. And this works fine as long as keys are strings.
In the edge case of tree(). Keys are objects and this changes the game because 
in JSON keys can only be strings. So the serialization does the following :

{code}
{vp[name->stephen]: vp[name->marko]}
{code}
In the case of tree serialization this becomes:
{code}
{
   "@class" : "org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree",
   "key": {
      "@class": "org.apache.tinkerpop.gremlin.structure.VertexProperty",
      "id": 0,
      "label": "name",
      "value": "stephen"
   }, 
   "value": {
      "@class": "org.apache.tinkerpop.gremlin.structure.VertexProperty",
      "id": 0,
      "label": "name",
      "value": "marko"
   }
}
{code}

But clearly the deserialization needs to understand that this is a specific 
scenario where {{key}} and {{value}} need to be mapped differently.

Basically in the case of tree the deserialization would expect :
{code}
{
   "@class" : "org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree",
   {
      "@class": "org.apache.tinkerpop.gremlin.structure.VertexProperty",
      "id": 0,
      "label": "name",
      "value": "stephen"
   }: {
      "@class": "org.apache.tinkerpop.gremlin.structure.VertexProperty",
      "id": 0,
      "label": "name",
      "value": "marko"
   }
}
{code}
But this is invalid JSON.

To support this I think we would need to implement custom mappers.

Is this making any sense?

> gremlin-server GraphSON serializer issue with tree()
> ----------------------------------------------------
>
>                 Key: TINKERPOP-732
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-732
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 3.0.2-incubating
>            Reporter: Dylan Millikin
>            Assignee: Dylan Millikin
>
> When using the {{tree()}} step with a GraphSON serializer the server hangs 
> (though I've seen some form of serialization errors in more complex scenarios 
> over titan).
> The following works fine in the console but fails using the graphSON 
> serializer:
> {code:java}
> g.V(1).repeat(out()).until(out().count().is(0)).tree() // fails with .next() 
> as well
> {code}
> The following works without a problem though:
> {code:java}
> g.V(1).repeat(out()).until(out().count().is(0))
> {code}
> Here's the configuration file I use for these tests:
> {code}
> host: localhost
> port: 8182
> threadPoolWorker: 1
> gremlinPool: 8
> scriptEvaluationTimeout: 30000
> serializedResponseTimeout: 30000
> channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
> graphs: {
>   graph: conf/tinkergraph-empty.properties
> }
> plugins:
>   - tinkerpop.tinkergraph
> scriptEngines: {
>   gremlin-groovy: {
>     imports: [java.lang.Math],
>     staticImports: [java.lang.Math.PI],
>     scripts: [scripts/generate-classic.groovy]}}
> serializers:
>   - { className: 
> org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
>   - { className: 
> org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { 
> serializeResultToString: true }}
>   - { className: 
> org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 }
>   - { className: 
> org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }
> processors:
>   - { className: 
> org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { 
> sessionTimeout: 28800000 }}
> metrics: {
>   consoleReporter: {enabled: true, interval: 180000},
>   csvReporter: {enabled: true, interval: 180000, fileName: 
> /tmp/gremlin-server-metrics.csv},
>   jmxReporter: {enabled: true},
>   slf4jReporter: {enabled: true, interval: 180000},
>   gangliaReporter: {enabled: false, interval: 180000, addressingMode: 
> MULTICAST},
>   graphiteReporter: {enabled: false, interval: 180000}
> }
> threadPoolBoss: 1
> maxInitialLineLength: 4096
> maxHeaderSize: 8192
> maxChunkSize: 8192
> maxContentLength: 65536
> maxAccumulationBufferComponents: 1024
> resultIterationBatchSize: 64
> writeBufferHighWaterMark: 32768
> writeBufferHighWaterMark: 65536
> ssl: {
>   enabled: false} 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to