Skip to content

pipelining + suspended ChunkedInput triggers StackOverflowError in ChunkedWriteHandler.flush() #620

@losipiuk

Description

@losipiuk

We encountered an issue with ChunkedWriteHandler (netty version 3.5.7).

We get StackOverflowError in following scenario:

  • ChunkWriteHandler.queue is not empty
  • ChunkedWriteHandler.currentEvent is not null and it stores ChunkedInput as message
  • chunkedInput stored in currentEvent is in suspended mode (nextChunk returns null but isEndOfInput returns false).

In such case break from while loop in line 248 is executed.
But then immediately after that flush() is called again recursively in line 301, because condition in line 300 evaluates to true.

If chunkedInput is in suspended mode long enough we get StackOverFlowException.

As a fix I moved suspend variable above while loop and modified condition in line 300 to:

if (acquired && (!channel.isConnected() || channel.isWritable() && (!queue.isEmpty() && !suspend))) { 

I am not exactly sure if it does not break something but it seems to fix an issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions