Occasional stream corruption

Trustin Lee (이희승) trustin at gmail.com
Fri Nov 20 22:25:37 EST 2009


Mike,

On Thu, Nov 19, 2009 at 9:15 PM, MikeQ <michaelquilleash at hotmail.com> wrote:
> Trustin Lee wrote:
>>
>> If you write messages from multiple threads, the order of the write
>> requests will be mixed.  However, the content of each write request
>> should never get mixed.  That is, if you write "AB" and "CD" from two
>> threads, the resulting output could be either "ABCD" or "CDAB", while
>> "BACD", "ABDC", "CDBA", and "DCAB" are impossible.  If you are seeing
>> the abnormal corruption, please let me know.  I'd like to investigate
>> further with more information.
>>
>
> Thanks for the reply.
>
> Understood, but I am only using a single thread to write the reply.  I do
> write the response in "pieces" so there may be several calls to write() per
> complete response but if ordering of write() implies physical ordering of
> data this should be working ok.
>
> The problem is tough to reproduce as it is pretty random and only happens
> occasionally.
>
> I'll try and get some more info and come back to you.

Thanks!

> I think I need to drop some debugging helper in to trace the raw content
> going through the handlers.  If I insert a handler into the downstream chain
> can I just log out the raw bytes and see if I can isolate the issue by
> inspecting the packets?  Without otherwise disturbing the flow of the
> traffic?

You can use packet capturing tool such as WireShark.  Alternatively,
you can insert a LoggingHandler into your pipeline, but it might
decrease the chance of reproduction (Heisenbug :)

HTH

— Trustin Lee, http://gleamynode.net/



More information about the netty-users mailing list