Postponing of ChunkedWriteHandlers hasNextChunk retrieval after write operation

Trustin Lee (이희승) trustin at gmail.com
Sat Nov 21 03:12:47 EST 2009


Hi Tuomas,

On Wed, Nov 18, 2009 at 9:01 PM, Tuomas Kiviaho <tuomas.kiviaho at iki.fi> wrote:
>
> I was having a deadlock in my simple unit test using PipedInputStream and
> PipedOutputStream with ChunkedWriteHandler. I discovered that
> ChunkedWriteHandler checks for next chunk prior writing out the current
> chunk.

Are you mentioning the 182nd line of ChunkedWriteHandler that calls
ChunkedInput.hasNextChunk()?  It would be nice if you could include
the full thread dump.

> What if next chunk check is postponed after write operation? It doesn't seem
> to be impossible at first glance but I guess there's a good reason for this
> kind of implementation.

Yes, the next chunk check could be postponed after Channels.write(...)
call at line 214.  However, before making the modification, I'd like
to know why dead lock occurs.

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



More information about the netty-users mailing list