Skip to content

Commit

Permalink
pool: handle double remove of IdleStateHandler
Browse files Browse the repository at this point in the history
Motivation:
If http client issues two GET requests then zero-copy enabled http mover will try to
remove the IdleStateHandler twice and fail  with NoSuchElementException.

Modification:
Check the presence of IdleStateHandler before removal.

Result:
No failed transfers on GET+GET

Acked-by: Albert Rossi
Acked-by: Lea Morschel
Target: master, 9.1, 9.0, 8.2
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Aug 2, 2023
1 parent 633d133 commit 4be34ff
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -798,7 +798,10 @@ private Object read(ChannelHandlerContext context, NettyTransferService<HttpProt

if (_useZeroCopy) {
// disable timeout manager as zero-copy can't keep idle counters in sync
context.channel().pipeline().remove(IdleStateHandler.class);
var hasIdleStateHandler = context.channel().pipeline().get(IdleStateHandler.class) != null;
if (hasIdleStateHandler) {
context.channel().pipeline().remove(IdleStateHandler.class);
}
return asFileRegion(file, lowerRange, length);
}
return new ReusableChunkedNioFile(file, lowerRange, length, _chunkSize);
Expand Down

0 comments on commit 4be34ff

Please sign in to comment.