ihoro commented on pull request #1547:
URL: https://github.com/apache/tinkerpop/pull/1547#issuecomment-1028467119


   I’ve found an issue with T type. I’ve implemented its serialization 
according to the 
[spec](https://tinkerpop.apache.org/docs/current/dev/io/#_t_3). What means I 
send it like `{type_code}{type_info}` followed by non-fully-qualified string, 
i.e. `{length}{text_value}`. For example, T.label is sent as `0x2000 00000005 
6c6162656c`. But gremlin-server does not seem to expect it with the following 
stack trace:
   ```
   [WARN] DefaultChannelPipeline - An exceptionCaught() event was fired, and it 
reached at the tail of the pipeline. It usually means the last handler in the 
pipeline did not handle the exception.
   io.netty.handler.codec.DecoderException: 
java.lang.IndexOutOfBoundsException: readerIndex(92) + length(1388) exceeds 
writerIndex(178): PooledUnsafeDirectByteBuf(ridx: 92, widx: 178, cap: 211)
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
           at 
io.netty.handler.codec.http.websocketx.Utf8FrameValidator.channelRead(Utf8FrameValidator.java:82)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
           at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
           at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
           at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
           at 
io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
           at 
io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)
           at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
           at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
           at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
           at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: java.lang.IndexOutOfBoundsException: readerIndex(92) + 
length(1388) exceeds writerIndex(178): PooledUnsafeDirectByteBuf(ridx: 92, 
widx: 178, cap: 211)
           at 
io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442)
           at 
io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428)
           at 
io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:895)
           at 
io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:903)
           at 
org.apache.tinkerpop.gremlin.driver.ser.NettyBuffer.readBytes(NettyBuffer.java:132)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.StringSerializer.readValue(StringSerializer.java:37)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.StringSerializer.readValue(StringSerializer.java:28)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.readValue(SimpleTypeSerializer.java:59)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader.readValue(GraphBinaryReader.java:77)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader.read(GraphBinaryReader.java:102)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.EnumSerializer.readValue(EnumSerializer.java:66)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.EnumSerializer.readValue(EnumSerializer.java:44)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.readValue(SimpleTypeSerializer.java:59)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.read(SimpleTypeSerializer.java:47)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader.read(GraphBinaryReader.java:106)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.ByteCodeSerializer.getInstructionArguments(ByteCodeSerializer.java:56)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.ByteCodeSerializer.readValue(ByteCodeSerializer.java:41)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.ByteCodeSerializer.readValue(ByteCodeSerializer.java:30)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.readValue(SimpleTypeSerializer.java:59)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.read(SimpleTypeSerializer.java:47)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader.read(GraphBinaryReader.java:106)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.MapSerializer.readValue(MapSerializer.java:42)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.MapSerializer.readValue(MapSerializer.java:31)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.readValue(SimpleTypeSerializer.java:59)
           at 
org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader.readValue(GraphBinaryReader.java:77)
           at 
org.apache.tinkerpop.gremlin.driver.ser.binary.RequestMessageSerializer.readValue(RequestMessageSerializer.java:55)
           at 
org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1.deserializeRequest(GraphBinaryMessageSerializerV1.java:175)
           at 
org.apache.tinkerpop.gremlin.server.handler.WsGremlinBinaryRequestDecoder.decode(WsGremlinBinaryRequestDecoder.java:77)
           at 
org.apache.tinkerpop.gremlin.server.handler.WsGremlinBinaryRequestDecoder.decode(WsGremlinBinaryRequestDecoder.java:43)
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
           ... 39 more
   ```
   I’ve tried a fully-qualified string instead and gremlin-server is happy with 
it, i.e. it expects a fully-qualified string.
   
   Q1: Is it a typo within the spec? Usually it explicitly mentions when a 
fully-qualified form is required, and non-FQ is expected otherwise.
   Q2: If A1 is true then, I guess, the same is applied to other Enum based 
types like Cardinality, Order, and so on, right?
   Q3: By the way, when gremlin-server errors in case of a non-fully-qualified 
string then a client gets no response and waits until its own timeout. Maybe a 
client should get something like 'wrong request' response instead of keeping 
silence from the server side? But this is a side question, not related to 
GraphBinary implementation for gremlin-javascript. Does it need a JIRA ticket 
creation for future consideration?
   
   Could you please guide me from gremlin-core Java side perspective? I will 
help with a PR to fix the spec, if it gets confirmed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to