garbled data passed in cumulation buffer for decode(), probably when data re-transmission.

huican ping pinghuican at gmail.com
Thu Sep 10 18:15:11 EDT 2009


Hello Trustin,

FYI,
1:) I didn't see the problem for the persistent connection case.
    That problem was observed when clients create new connections each
transaction, and TPS is about 4000 msgs/sec with 1066 bytes input.
2:) b.setOption("child.receiveBufferSize", 10240); has no effects.

Really I have no idea how this one happens.

Thanks


On Thu, Sep 10, 2009 at 1:31 PM, huican ping <pinghuican at gmail.com> wrote:
> FYI, my decoder inherited from the FrameDecoder.
>
> Thanks
> Huican Ping
>
> On Thu, Sep 10, 2009 at 1:23 PM, Huican Ping <pinghuican at gmail.com> wrote:
>>
>> Hello Trustin,
>>
>> I have a protocl based on tcp and will read-in data which was wrapped with
>> startBlockByte and endBlockByte+TrailingCR.
>>
>> The coming wrapped data is 1065 bytes. And I am using the default default
>> socket buffer size, so I think it is 1024 byte. With 1065 bytes input from
>> client, I think netty needs 2 reads for the socket.
>>
>> At some very rare time under heavy TPS, when my decode parser tries to
>> decode() the buffer passed in, and I noticed that data is garbled.
>>
>> Below are two failures observed:
>>  1:) I noticed that The first failed one and 2nd failed part combines into
>> a whole message.
>>  2:) Those two failures happened about 1 minute interval.
>>  3:) I also noticed that the first part is exactly 1024byte which is same
>> as socket buffer.
>>       The coming data has 1065 bytes, and socket buffer size is 1024.
>>
>> It happens very rare and with high TPS. I think probably when netty code (or
>> somewhere) doesn’t correctly construct the final buffer to all the incoming
>> date from 2 times socket reads in the case of data retransmission.
>>
>> Can you please check that?
>>    <body>
>>      <infoMsg>ReceiveTimeout while got partial received message from
>> channel=963160213, bytes=1065, readerIndex=0, writerIndex=1065, byte at
>> readerIndex=60, byte at writerIndex-1=0, decoderState=MSG_START_FOUND,
>> content=&lt;?xml version=&quot;1.0&quot;?>&#13;
>>        &lt;!--* po1.xml, from
>> http://www.w3.org/TR/xmlschema-0/#UnqualLocals *-->&#13;
>>        &lt;!--* Retrieved  *-->&#13;
>>        &lt;!--* Expanded to be a complete document by MSM *-->&#13;
>>        &#13;
>>        &lt;apo:purchaseOrder
>> xmlns:apo=&quot;http://www.example.com/PO1&quot;&#13;
>>                           orderDate=&quot;1999-10-21&quot;>&#13;
>>            &lt;shipTo country=&quot;US&quot;>&#13;
>>                &lt;name>Alice Smith&lt;/name>&#13;
>>                &lt;street>123 Maple Street&lt;/street>&#13;
>>                &lt;!-- etc. -->&#13;
>>                &lt;city>Mill Valley&lt;/city>&#13;
>>                &lt;state>CA&lt;/state>&#13;
>>                &lt;zip>90952&lt;/zip>&#13;
>>            &lt;/shipTo>&#13;
>>            &lt;billTo country=&quot;US&quot;>&#13;
>>                &lt;name>Robert Smith&lt;/name>&#13;
>>                &lt;street>8 Oak Avenue&lt;/street>&#13;
>>                &lt;!-- etc. -->&#13;
>>                &lt;city>Old Town&lt;/city>&#13;
>>                &lt;state>PA&lt;/state>&#13;
>>                &lt;zip>95819&lt;/zip>&#13;
>>            &lt;/billTo>&#13;
>>            &lt;apo:comment>Hurry, my lawn is going
>> wild!&lt;/apo:comment>&#13;
>>            &lt;items>&#13;
>>                &lt;item partNum=&quot;926-AA&quot;>&#13;
>>                    &lt;productName>Baby Monitor&lt;/productName>&#13;
>>                    &lt;quantity>1&lt;/quantity>&#13;
>>                    &lt;USPrice>39.98&lt;/USPrice>&#13;
>>                    &lt;shipDate>1999-05-21&lt;/shipDate>&#13;
>>                &lt;/ite..........................................</infoMsg>
>>    </body>
>>    <body>
>>      <infoMsg>No new data received in 30,000 milliseconds, closing the
>> channel
>>        com.acme.utils.ReceiveTimeoutException: No new data received in
>> 30,000 milliseconds, closing the channel
>>        at
>> com.acme.utils.ReceiveTimeoutHandler.readTimedOut(ReceiveTimeoutHandler.java:38)
>>        at
>> org.jboss.netty.handler.timeout.ReadTimeoutHandler$ReadTimeoutTask.run(ReadTimeoutHandler.java:196)
>>        at
>> org.jboss.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:506)
>>        at
>> org.jboss.netty.util.HashedWheelTimer$Worker.notifyExpiredTimeouts(HashedWheelTimer.java:421)
>>        at
>> org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:371)
>>        at java.lang.Thread.run(Thread.java:619)
>>        </infoMsg>
>>    </body>
>>
>>    <body>
>>      <infoMsg>read date into WritableMessage size=1064
>> content=................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................m>&#13;
>>            &lt;/items>&#13;
>>        &lt;/apo:purchaseOrder>&#13;
>>        </infoMsg>
>>    </body>
>>    <body>
>>      <infoMsg>bad message received. Found EndBlockChar, but Missing
>> startBlockCharacter.</infoMsg>
>>
>> --
>> View this message in context: http://n2.nabble.com/garbled-data-passed-in-cumulation-buffer-for-decode-probably-when-data-re-transmission-tp3618321p3618321.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>



More information about the netty-users mailing list